parallel: Fixed bug #58985: sem stall if .parallel/semaphore is chmod 0

This commit is contained in:
Ole Tange 2020-08-30 20:03:37 +02:00
parent e6c9dfe010
commit 555863c0b5
4 changed files with 50 additions and 2 deletions

View file

@ -12866,8 +12866,15 @@ sub new($) {
my $parallel_locks = $Global::cache_dir . "/semaphores";
-d $parallel_locks or ::mkdir_or_die($parallel_locks);
my $lockdir = "$parallel_locks/$id";
my $lockfile = $lockdir.".lock";
if(-d $parallel_locks and -w $parallel_locks
and -r $parallel_locks and -x $parallel_locks) {
# skip
} else {
::error("Semaphoredir must be writable: '$parallel_locks'");
::wait_and_exit(255);
}
if($count < 1) { ::die_bug("semaphore-count: $count"); }
return bless {
'lockfile' => $lockfile,

View file

@ -15,24 +15,34 @@ install_packages() {
# DEBIAN package
packaging_pkgs="dpkg-dev build-essential debhelper osc cvs automake-1.15"
packaging_pkgs="$packaging_pkgs python3-m2crypto alien"
# SHEBANG TOOLS
shebang_pkgs="gnuplot octave ruby r-base-core"
# SQL TOOLS
sql_pkgs="libdbd-pg-perl libdbd-sqlite3-perl libdbd-csv-perl"
sql_pkgs="$sql_pkgs libdbd-mysql-perl rlwrap"
# Compression
compression_pkgs="zstd clzip liblz4-tool lzop pigz pixz gzip plzip pbzip2"
compression_pkgs="$compression_pkgs lzma xz-utils lzip bzip2 lbzip2 lrzip"
compression_pkgs_missing="pxz"
# Shells
# (csh = bsd-csh that is broken)
shell_pkgs="ash dash fdclone fish fizsh ksh ksh93 mksh posh rc rush sash"
shell_pkgs="$shell_pkgs tcsh yash zsh"
# Databases
database_pkgs="postgresql mysql-server sqlite"
# Build packages
build_pkgs="libxxhash-dev libzstd-dev liblz4-dev libssl-dev"
build_pkgs="$build_pkgs python3-cmarkgfm"
sudo dpkg --add-architecture i386; sudo apt update
if $INSTALL $test_pkgs $packaging_pkgs $shebang_pkgs $sql_pkgs \
$compression_pkgs $shell_pkgs $database_pkgs; then
$compression_pkgs $shell_pkgs $database_pkgs $build_pkgs ; then
# OK
true
else
@ -324,6 +334,28 @@ bash_versions() {
)
}
rsync_versions() {
(cd /tmp
git clone https://github.com/WayneD/rsync
make_one() {
rsync -a --delete rsync/ rsync-$1/
cd rsync-$1
git reset --hard
git checkout $1
LDFLAGS=-static ./configure &&
make -j2 &&
sudo cp rsync /usr/local/bin/rsync-$1
}
export -f make_one
echo '# Building rsync'
(cd rsync; git tag | grep -v -- '-.*-' | grep -v pre) |
stdout parallel --lb --tag \
'/usr/local/bin/rsync-{} --version || make_one {}'
(cd rsync; git tag | grep -v -- '-.*-' | grep -v pre) |
parallel -k -v --tag '/usr/local/bin/rsync-{} --version'
)
}
misc() {
parallel --record-env

View file

@ -1,5 +1,12 @@
#!/bin/bash
par_sem_dir() {
echo '### bug #58985: sem stall if .parallel/semaphores is chmod 0'
chmod 0 ~/.parallel/semaphores
sem echo
chmod 700 ~/.parallel/semaphores
}
par_parcat_mixing() {
echo 'parcat output should mix: a b a b'
mktmpfifo() {

View file

@ -86,5 +86,7 @@ par_print_before_halt_on_error 2 exit code 1
par_print_before_halt_on_error 2 0.1 0.1
par_print_before_halt_on_error 2 parallel: This job failed:
par_print_before_halt_on_error 2 perl -e 'sleep 1; sleep $ARGV[0]; print STDERR "",@ARGV,"\n"; 2 > 0 ? exit shift : exit not shift;' 1
par_sem_dir ### bug #58985: sem stall if .parallel/semaphores is chmod 0
par_sem_dir parallel: Error: Semaphoredir must be writable: '~/.parallel/semaphores'
par_tmux_termination ### --tmux test - check termination
par_tmux_termination See output with: tmux -S /tmp/parallel-local-race01-tmpdir/tmsXXXXX attach