mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-24 23:17:55 +00:00
bug #55399: Clean up --wd ... when run locally.
bug #55398: set $OLDPWD when using --wd.
This commit is contained in:
parent
48b1743b84
commit
e79d1d978b
|
@ -199,51 +199,25 @@ http://groups.google.com/group/comp.unix.admin/post
|
|||
https://lists.gnu.org/mailman/admindb/bug-parallel
|
||||
https://lists.gnu.org/mailman/admindb/parallel
|
||||
|
||||
<<<<<
|
||||
file:///home/tange/privat/parallel/doc/release_new_version
|
||||
|
||||
from:tange@gnu.org
|
||||
to:parallel@gnu.org, bug-parallel@gnu.org
|
||||
stable-bcc: Jesse Alama <jessealama@fastmail.fm>
|
||||
|
||||
<<<<<<< HEAD
|
||||
Subject: GNU Parallel 20190122 ('Indonesia=Tanjung Lesung=Sunda') released <<[stable]>>
|
||||
|
||||
GNU Parallel 20190122 ('') <<[stable]>> has been released. It is available for download at: http://ftpmirror.gnu.org/parallel/
|
||||
=======
|
||||
Subject: GNU Parallel 20181222 ('Yellow Jacket/InSight/Jacob Sparre') released <<[stable]>>
|
||||
|
||||
GNU Parallel 20181222 ('Jacob Sparre') <<[stable]>> has been released. It is available for download at: http://ftpmirror.gnu.org/parallel/
|
||||
>>>>>>> 41a40a1304b92206859d061fa1bb2e22d9cfc196
|
||||
|
||||
<<No new functionality was introduced so this is a good candidate for a stable release.>>
|
||||
|
||||
Quote of the month:
|
||||
|
||||
<<<<<<< HEAD
|
||||
<<>>
|
||||
|
||||
New in this release:
|
||||
|
||||
*
|
||||
=======
|
||||
GNU parallel is a seriously powerful flexible and tool.
|
||||
-- Greg Hurrell @wincent
|
||||
|
||||
New in this release:
|
||||
|
||||
* Better /proc/cpuinfo parser.
|
||||
|
||||
* Simpler job scheduling flow.
|
||||
|
||||
* MPGI Workshop: Job Parallelization with Task Arrays and GNU Parallel https://www.msi.umn.edu/tutorials/mpgi-workshop-module-4
|
||||
|
||||
* CONCOCT uses GNU Parallel https://media.readthedocs.org/pdf/concoct/latest/concoct.pdf
|
||||
|
||||
* If you use SLURM read https://wiki.hpc.uconn.edu/index.php/Advanced_SLURM
|
||||
|
||||
* すぐ忘れてしまう、仕事で使う技 https://qiita.com/hana_shin/items/53c3c78525c9c758ae7c
|
||||
>>>>>>> 41a40a1304b92206859d061fa1bb2e22d9cfc196
|
||||
* Using GNU Parallel in pentesting https://youtu.be/mZ0OUJmkIlA?t=873
|
||||
|
||||
* Bug fixes and man page updates.
|
||||
|
||||
|
|
35
src/parallel
35
src/parallel
|
@ -1516,6 +1516,7 @@ sub init_globals() {
|
|||
$Global::max_jobs_running = 0;
|
||||
$Global::job_already_run = '';
|
||||
$ENV{'TMPDIR'} ||= "/tmp";
|
||||
$ENV{'OLDPWD'} = $ENV{'PWD'};
|
||||
if(not $ENV{HOME}) {
|
||||
# $ENV{HOME} is sometimes not set if called from PHP
|
||||
::warning("\$HOME not set. Using /tmp.");
|
||||
|
@ -2165,7 +2166,6 @@ sub cleanup() {
|
|||
|
||||
sub __QUOTING_ARGUMENTS_FOR_SHELL__() {}
|
||||
|
||||
|
||||
sub shell_quote(@) {
|
||||
# Input:
|
||||
# @strings = strings to be quoted
|
||||
|
@ -2285,7 +2285,7 @@ sub shell_quote_file($) {
|
|||
return Q($a);
|
||||
}
|
||||
|
||||
sub shell_words() {
|
||||
sub shell_words(@) {
|
||||
# Input:
|
||||
# $string = shell line
|
||||
# Returns:
|
||||
|
@ -2307,6 +2307,7 @@ sub perl_quote_scalar($) {
|
|||
return $a;
|
||||
}
|
||||
|
||||
# -w complains about prototype
|
||||
sub pQ($) {
|
||||
# pQ alias for ::perl_quote_scalar
|
||||
*pQ = \&::perl_quote_scalar;
|
||||
|
@ -5007,6 +5008,7 @@ sub usleep($) {
|
|||
select(undef, undef, undef, $ms/1000);
|
||||
}
|
||||
|
||||
sub __KILLER_REAPER__() {}
|
||||
sub reap_usleep() {
|
||||
# Reap dead children.
|
||||
# If no dead children: Sleep specified amount with exponential backoff
|
||||
|
@ -6955,7 +6957,7 @@ sub rsync_transfer_cmd($) {
|
|||
rsync()." $rsync_opts $file $serverlogin:$rsync_destdir";
|
||||
}
|
||||
|
||||
sub cleanup_cmd($) {
|
||||
sub cleanup_cmd($$$) {
|
||||
# Command to run to remove the remote file
|
||||
# Input:
|
||||
# $file = filename to remove
|
||||
|
@ -8239,7 +8241,13 @@ sub sshlogin_wrap($) {
|
|||
$wd =~ s:^([^/]):$ENV{'HOME'}/$1:;
|
||||
}
|
||||
::mkdir_or_die($wd);
|
||||
$command = "cd ".::Q($wd)." || exit 255; ".$command;
|
||||
my $post = "";
|
||||
if($opt::workdir eq "...") {
|
||||
$post = ";".exitstatuswrapper("rm -rf ".::Q($wd).";");
|
||||
|
||||
}
|
||||
$command = "cd ".::Q($wd)." || exit 255; " .
|
||||
$command . $post;;
|
||||
}
|
||||
if(@opt::env) {
|
||||
# Prepend with environment setter, which sets functions in zsh
|
||||
|
@ -8299,7 +8307,7 @@ sub sshlogin_wrap($) {
|
|||
$post .= $self->sshcleanup();
|
||||
if($post) {
|
||||
# We need to save the exit status of the job
|
||||
$post = '_EXIT_status=$?; ' . $post . ' exit $_EXIT_status;';
|
||||
$post = exitstatuswrapper($post);
|
||||
}
|
||||
$self->{'sshlogin_wrap'}{$command} =
|
||||
($pre
|
||||
|
@ -8467,6 +8475,19 @@ sub remote_cleanup($) {
|
|||
}
|
||||
}
|
||||
|
||||
sub exitstatuswrapper(@) {
|
||||
if($Global::cshell) {
|
||||
return ('set _EXIT_status=$status; ' .
|
||||
join(" ",@_).
|
||||
'exit $_EXIT_status;');
|
||||
} else {
|
||||
return ('_EXIT_status=$?; ' .
|
||||
join(" ",@_).
|
||||
'exit $_EXIT_status;');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
sub workdir($) {
|
||||
# Returns:
|
||||
# the workdir on a remote machine
|
||||
|
@ -10824,14 +10845,14 @@ package MultifileQueue;
|
|||
|
||||
@Global::unget_argv=();
|
||||
|
||||
sub new($) {
|
||||
sub new($$) {
|
||||
my $class = shift;
|
||||
my $fhs = shift;
|
||||
for my $fh (@$fhs) {
|
||||
if(-t $fh and -t ($Global::status_fd || *STDERR)) {
|
||||
::warning("Input is read from the terminal. You either know what you",
|
||||
"are doing (in which case: YOU ARE AWESOME!) or you forgot",
|
||||
"::: or :::: or to pipe data into parallel. If so",
|
||||
"::: or :::: or -a or to pipe data into parallel. If so",
|
||||
"consider going through the tutorial: man parallel_tutorial",
|
||||
"Press CTRL-D to exit.");
|
||||
}
|
||||
|
|
|
@ -892,6 +892,15 @@ par_halt_on_error_division_by_zero() {
|
|||
echo $?
|
||||
}
|
||||
|
||||
par_wd_dotdotdot() {
|
||||
echo '### parallel --wd ... should clean up'
|
||||
parallel --wd ... 'pwd;true' ::: foo | parallel ls 2>/dev/null
|
||||
echo $? == 1
|
||||
echo '### $OLDPWD should be the dir in which parallel starts'
|
||||
cd /tmp
|
||||
parallel --wd ... 'echo $OLDPWD' ::: foo
|
||||
}
|
||||
|
||||
export -f $(compgen -A function | grep par_)
|
||||
compgen -A function | grep par_ | LC_ALL=C sort |
|
||||
parallel --timeout 20 -j6 --tag -k --joblog +/tmp/jl-`basename $0` '{} 2>&1'
|
||||
|
|
|
@ -20,10 +20,10 @@ echo '### bug #39572: --tty and --joblog do not work'
|
|||
seq 1 | parallel --joblog - -u true | tr '0-9' 'X'
|
||||
|
||||
echo '### How do we deal with missing $HOME'
|
||||
unset HOME; stdout perl -w $(which parallel) -k echo ::: 1 2 3
|
||||
unset HOME; stdout perl $(which parallel) -k echo ::: 1 2 3
|
||||
|
||||
echo '### How do we deal with missing $SHELL'
|
||||
unset SHELL; stdout perl -w $(which parallel) -k echo ::: 1 2 3
|
||||
unset SHELL; stdout perl $(which parallel) -k echo ::: 1 2 3
|
||||
|
||||
echo '### Test if length is computed correctly - first should give one line, second 2 lines each'
|
||||
seq 4 | parallel -s 29 -X -kj1 echo a{}b{}c
|
||||
|
|
|
@ -1690,3 +1690,7 @@ par_wd_3dot_local OK
|
|||
par_wd_3dot_local ~/privat/parallel/testsuite
|
||||
par_wd_3dot_local ~/privat/parallel/testsuite
|
||||
par_wd_3dot_local OK
|
||||
par_wd_dotdotdot ### parallel --wd ... should clean up
|
||||
par_wd_dotdotdot 1 == 1
|
||||
par_wd_dotdotdot ### $OLDPWD should be the dir in which parallel starts
|
||||
par_wd_dotdotdot /tmp foo
|
||||
|
|
|
@ -91,24 +91,14 @@ Seq Host Starttime JobRuntime Send Receive Exitval Signal Command
|
|||
X : XXXXXXXXXX.XXX X.XXX X X X X true X
|
||||
echo '### How do we deal with missing $HOME'
|
||||
### How do we deal with missing $HOME
|
||||
unset HOME; stdout perl -w $(which parallel) -k echo ::: 1 2 3
|
||||
main::shell_quote_scalar() called too early to check prototype at /usr/local/bin/parallel line 2299.
|
||||
main::Q() called too early to check prototype at /usr/local/bin/parallel line 2306.
|
||||
main::pQ() called too early to check prototype at /usr/local/bin/parallel line 2353.
|
||||
Arg::Q() called too early to check prototype at /usr/local/bin/parallel line 11163.
|
||||
Arg::pQ() called too early to check prototype at /usr/local/bin/parallel line 11169.
|
||||
unset HOME; stdout perl $(which parallel) -k echo ::: 1 2 3
|
||||
parallel: Warning: $HOME not set. Using /tmp.
|
||||
1
|
||||
2
|
||||
3
|
||||
echo '### How do we deal with missing $SHELL'
|
||||
### How do we deal with missing $SHELL
|
||||
unset SHELL; stdout perl -w $(which parallel) -k echo ::: 1 2 3
|
||||
main::shell_quote_scalar() called too early to check prototype at /usr/local/bin/parallel line 2299.
|
||||
main::Q() called too early to check prototype at /usr/local/bin/parallel line 2306.
|
||||
main::pQ() called too early to check prototype at /usr/local/bin/parallel line 2353.
|
||||
Arg::Q() called too early to check prototype at /usr/local/bin/parallel line 11163.
|
||||
Arg::pQ() called too early to check prototype at /usr/local/bin/parallel line 11169.
|
||||
unset SHELL; stdout perl $(which parallel) -k echo ::: 1 2 3
|
||||
1
|
||||
2
|
||||
3
|
||||
|
|
Loading…
Reference in a new issue