mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 14:07:55 +00:00
parallel: Cleaned up error() and warning().
This commit is contained in:
parent
d4c347c22b
commit
09de088df9
227
src/parallel
227
src/parallel
|
@ -393,7 +393,7 @@ sub spreadstdin {
|
|||
my $old_blocksize = $blocksize;
|
||||
$blocksize = ::min(ceil($blocksize * 1.3 + 1), $two_gb);
|
||||
::warning("A record was longer than $old_blocksize. " .
|
||||
"Increasing to --blocksize $blocksize\n");
|
||||
"Increasing to --blocksize $blocksize.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -930,7 +930,7 @@ sub parse_options {
|
|||
$opt::memfree = multiply_binary_prefix($opt::memfree);
|
||||
if(defined $opt::controlmaster) { $opt::noctrlc = 1; }
|
||||
if(defined $opt::timeout and $opt::timeout !~ /^\d+(\.\d+)?%?$/) {
|
||||
::error("--timeout must be seconds or percentage\n");
|
||||
::error("--timeout must be seconds or percentage.");
|
||||
wait_and_exit(255);
|
||||
}
|
||||
if(defined $opt::minversion) {
|
||||
|
@ -1014,8 +1014,8 @@ sub parse_options {
|
|||
if(defined $opt::pipepart and
|
||||
(defined $opt::L or defined $opt::max_lines
|
||||
or defined $opt::max_replace_args)) {
|
||||
::error("--pipepart is incompatible with --max-replace-args, ",
|
||||
"--max-lines, and -L.\n");
|
||||
::error("--pipepart is incompatible with --max-replace-args, ".
|
||||
"--max-lines, and -L.");
|
||||
wait_and_exit(255);
|
||||
}
|
||||
if(grep /^$Global::arg_sep$|^$Global::arg_file_sep$/o, @ARGV) {
|
||||
|
@ -1031,14 +1031,14 @@ sub parse_options {
|
|||
$opt::progress = $opt::bar;
|
||||
}
|
||||
if(defined $opt::retired) {
|
||||
::error("-g has been retired. Use --group.\n");
|
||||
::error("-B has been retired. Use --bf.\n");
|
||||
::error("-T has been retired. Use --tty.\n");
|
||||
::error("-U has been retired. Use --er.\n");
|
||||
::error("-W has been retired. Use --wd.\n");
|
||||
::error("-Y has been retired. Use --shebang.\n");
|
||||
::error("-H has been retired. Use --halt.\n");
|
||||
::error("--tollef has been retired. Use -u -q --arg-sep -- and --load for -l.\n");
|
||||
::error("-g has been retired. Use --group.",
|
||||
"-B has been retired. Use --bf.",
|
||||
"-T has been retired. Use --tty.",
|
||||
"-U has been retired. Use --er.",
|
||||
"-W has been retired. Use --wd.",
|
||||
"-Y has been retired. Use --shebang.",
|
||||
"-H has been retired. Use --halt.",
|
||||
"--tollef has been retired. Use -u -q --arg-sep -- and --load for -l.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
citation_notice();
|
||||
|
@ -1051,7 +1051,7 @@ sub parse_options {
|
|||
# As we do not know the max line length on the remote machine
|
||||
# long commands generated by xargs may fail
|
||||
# If $opt::max_replace_args is set, it is probably safe
|
||||
::warning("Using -X or -m with --sshlogin may fail.\n");
|
||||
::warning("Using -X or -m with --sshlogin may fail.");
|
||||
}
|
||||
|
||||
if(not defined $opt::jobs) {
|
||||
|
@ -1110,7 +1110,7 @@ sub init_globals {
|
|||
$ENV{'TMPDIR'} ||= "/tmp";
|
||||
if(not $ENV{HOME}) {
|
||||
# $ENV{HOME} is sometimes not set if called from PHP
|
||||
::warning("\$HOME not set. Using /tmp\n");
|
||||
::warning("\$HOME not set. Using /tmp.");
|
||||
$ENV{HOME} = "/tmp";
|
||||
}
|
||||
}
|
||||
|
@ -1266,7 +1266,7 @@ sub parse_semaphore {
|
|||
}
|
||||
if($Global::interactive and $opt::bg) {
|
||||
::error("Jobs running in the ".
|
||||
"background cannot be interactive.\n");
|
||||
"background cannot be interactive.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -1279,7 +1279,7 @@ sub record_env {
|
|||
if(open(my $vars_fh, ">", $ignore_filename)) {
|
||||
print $vars_fh map { $_,"\n" } keys %ENV;
|
||||
} else {
|
||||
::error("Cannot write to $ignore_filename.\n");
|
||||
::error("Cannot write to $ignore_filename.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -1321,7 +1321,7 @@ sub open_joblog {
|
|||
if(($opt::resume or $opt::resume_failed)
|
||||
and
|
||||
not ($opt::joblog or $opt::results)) {
|
||||
::error("--resume and --resume-failed require --joblog or --results.\n");
|
||||
::error("--resume and --resume-failed require --joblog or --results.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
if($opt::joblog) {
|
||||
|
@ -1343,6 +1343,7 @@ sub open_joblog {
|
|||
# This is 30% faster than set_job_already_run($1);
|
||||
vec($Global::job_already_run,($1||0),1) = 1;
|
||||
} elsif(not /\d+\s+[^\s]+\s+([-0-9.]+\s+){6}/) {
|
||||
chomp;
|
||||
::error("Format of '$opt::joblog' is wrong: $_");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
|
@ -1353,7 +1354,7 @@ sub open_joblog {
|
|||
if($append) {
|
||||
# Append to joblog
|
||||
if(not open($Global::joblog, ">>", $opt::joblog)) {
|
||||
::error("Cannot append to --joblog $opt::joblog.\n");
|
||||
::error("Cannot append to --joblog $opt::joblog.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
} else {
|
||||
|
@ -1362,7 +1363,7 @@ sub open_joblog {
|
|||
$Global::joblog = $Global::fd{1};
|
||||
} elsif(not open($Global::joblog, ">", $opt::joblog)) {
|
||||
# Overwrite the joblog
|
||||
::error("Cannot write to --joblog $opt::joblog.\n");
|
||||
::error("Cannot write to --joblog $opt::joblog.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
print $Global::joblog
|
||||
|
@ -1484,7 +1485,7 @@ sub read_options {
|
|||
if(grep /^$profile$/, @config_profiles) {
|
||||
# config file is not required to exist
|
||||
} else {
|
||||
::error("$profile not readable.\n");
|
||||
::error("$profile not readable.");
|
||||
wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -1758,7 +1759,7 @@ sub open_or_exit {
|
|||
}
|
||||
my $fh = gensym;
|
||||
if(not open($fh, "<", $file)) {
|
||||
::error("Cannot open input file `$file': No such file or directory.\n");
|
||||
::error("Cannot open input file `$file': No such file or directory.");
|
||||
wait_and_exit(255);
|
||||
}
|
||||
return $fh;
|
||||
|
@ -2011,15 +2012,15 @@ sub init_run_jobs {
|
|||
# Count down the number of jobs to run for this SSHLogin.
|
||||
my $max = $sshlogin->max_jobs_running();
|
||||
if($max > 1) { $max--; } else {
|
||||
::error("No more processes: cannot run a single job. Something is wrong.\n");
|
||||
::error("No more processes: cannot run a single job. Something is wrong.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
$sshlogin->set_max_jobs_running($max);
|
||||
# Sleep up to 300 ms to give other processes time to die
|
||||
::usleep(rand()*300);
|
||||
::warning("No more processes: ",
|
||||
"Decreasing number of running jobs to $max. ",
|
||||
"Raising ulimit -u or /etc/security/limits.conf may help.\n");
|
||||
::warning("No more processes: ".
|
||||
"Decreasing number of running jobs to $max.",
|
||||
"Raising ulimit -u or /etc/security/limits.conf may help.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2027,7 +2028,7 @@ sub init_run_jobs {
|
|||
# No more file handles
|
||||
$no_more_file_handles_warned++ or
|
||||
::warning("No more file handles. ",
|
||||
"Raising ulimit -n or /etc/security/limits.conf may help.\n");
|
||||
"Raising ulimit -n or /etc/security/limits.conf may help.");
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -2096,7 +2097,7 @@ sub drain_job_queue {
|
|||
# These jobs may not be started:
|
||||
# * because there the --filter-hosts has removed all
|
||||
if(not %Global::host) {
|
||||
::error("There are no hosts left to run on.\n");
|
||||
::error("There are no hosts left to run on.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
# * because of loadavg
|
||||
|
@ -2104,7 +2105,7 @@ sub drain_job_queue {
|
|||
start_more_jobs();
|
||||
$sleep = ::reap_usleep($sleep);
|
||||
if($Global::max_jobs_running == 0) {
|
||||
::warning("There are no job slots available. Increase --jobs.\n");
|
||||
::warning("There are no job slots available. Increase --jobs.");
|
||||
}
|
||||
}
|
||||
} while ($Global::total_running > 0
|
||||
|
@ -2473,7 +2474,7 @@ sub expand_slf_shorthand {
|
|||
} elsif(not -r $file) {
|
||||
if(not -r $ENV{'HOME'}."/.parallel/".$file) {
|
||||
# Try prepending ~/.parallel
|
||||
::error("Cannot open $file.\n");
|
||||
::error("Cannot open $file.");
|
||||
::wait_and_exit(255);
|
||||
} else {
|
||||
$file = $ENV{'HOME'}."/.parallel/".$file;
|
||||
|
@ -2499,7 +2500,7 @@ sub read_sshloginfile {
|
|||
} else {
|
||||
if(not open($in_fh, "<", $file)) {
|
||||
# Try the filename
|
||||
::error("Cannot open $file.\n");
|
||||
::error("Cannot open $file.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -2587,15 +2588,15 @@ sub parse_sshlogin {
|
|||
if(not remote_hosts()) {
|
||||
# There are no remote hosts
|
||||
if(@opt::trc) {
|
||||
::warning("--trc ignored as there are no remote --sshlogin.\n");
|
||||
::warning("--trc ignored as there are no remote --sshlogin.");
|
||||
} elsif (defined $opt::transfer) {
|
||||
::warning("--transfer ignored as there are no remote --sshlogin.\n");
|
||||
::warning("--transfer ignored as there are no remote --sshlogin.");
|
||||
} elsif (@opt::return) {
|
||||
::warning("--return ignored as there are no remote --sshlogin.\n");
|
||||
::warning("--return ignored as there are no remote --sshlogin.");
|
||||
} elsif (defined $opt::cleanup) {
|
||||
::warning("--cleanup ignored as there are no remote --sshlogin.\n");
|
||||
::warning("--cleanup ignored as there are no remote --sshlogin.");
|
||||
} elsif (@opt::basefile) {
|
||||
::warning("--basefile ignored as there are no remote --sshlogin.\n");
|
||||
::warning("--basefile ignored as there are no remote --sshlogin.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -2624,7 +2625,7 @@ sub setup_basefile {
|
|||
if($sshlogin->string() eq ":") { next }
|
||||
for my $file (@opt::basefile) {
|
||||
if($file !~ m:^/: and $opt::workdir eq "...") {
|
||||
::error("Work dir '...' will not work with relative basefiles.\n");
|
||||
::error("Work dir '...' will not work with relative basefiles.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
$workdir ||= Job->new("")->workdir();
|
||||
|
@ -2669,7 +2670,7 @@ sub filter_hosts {
|
|||
parse_host_filtering(parallelized_host_filtering());
|
||||
|
||||
delete @Global::host{@$down_hosts_ref};
|
||||
@$down_hosts_ref and ::warning("Removed @$down_hosts_ref\n");
|
||||
@$down_hosts_ref and ::warning("Removed @$down_hosts_ref.");
|
||||
|
||||
$Global::minimal_command_line_length = 8_000_000;
|
||||
while (my ($sshlogin, $obj) = each %Global::host) {
|
||||
|
@ -2734,7 +2735,7 @@ sub parse_host_filtering {
|
|||
# signal == 127: parallel not installed remote
|
||||
# Set ncpus and ncores = 1
|
||||
::warning("Could not figure out ",
|
||||
"number of cpus on $host. Using 1.\n");
|
||||
"number of cpus on $host. Using 1.");
|
||||
$ncores{$host} = 1;
|
||||
$ncpus{$host} = 1;
|
||||
$maxlen{$host} = Limits::Command::max_length();
|
||||
|
@ -3282,16 +3283,14 @@ sub status {
|
|||
|
||||
sub warning {
|
||||
my @w = @_;
|
||||
my $fh = $Global::status_fd || *STDERR;
|
||||
my $prog = $Global::progname || "parallel";
|
||||
print $fh $prog, ": Warning: ", @w;
|
||||
status(map { ($prog, ": Warning: ", $_, "\n"); } @w);
|
||||
}
|
||||
|
||||
sub error {
|
||||
my @w = @_;
|
||||
my $fh = $Global::status_fd || *STDERR;
|
||||
my $prog = $Global::progname || "parallel";
|
||||
print $fh $prog, ": Error: ", @w;
|
||||
status(map { ($prog, ": Error: ", $_, "\n"); } @w);
|
||||
}
|
||||
|
||||
sub die_bug {
|
||||
|
@ -3401,6 +3400,14 @@ sub tmpname {
|
|||
# if you ssh to localhost (or a shared file system) under a different name
|
||||
my $name = shift;
|
||||
my($tmpname);
|
||||
if(not -w $ENV{'TMPDIR'}) {
|
||||
if(not -e $ENV{'TMPDIR'}) {
|
||||
::error("Tmpdir '$ENV{'TMPDIR'}' does not exist.","Try 'mkdir $ENV{'TMPDIR'}'");
|
||||
} else {
|
||||
::error("Tmpdir '$ENV{'TMPDIR'}' is not writable.","Try 'chmod +w $ENV{'TMPDIR'}'");
|
||||
}
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
do {
|
||||
$tmpname = $ENV{'TMPDIR'}."/".$name.
|
||||
join"", map { (0..9,"a".."z","A".."Z")[rand(62)] } (1..5);
|
||||
|
@ -3555,8 +3562,8 @@ sub multiply_binary_prefix {
|
|||
tell $disk_full_fh != 8193) {
|
||||
# On raspbian the disk can be full except for 10 chars.
|
||||
if(not $error_printed) {
|
||||
::error("Output is incomplete. Cannot append to buffer file in $ENV{'TMPDIR'}. Is the disk full?\n");
|
||||
::error("Change \$TMPDIR with --tmpdir or use --compress.\n");
|
||||
::error("Output is incomplete. Cannot append to buffer file in $ENV{'TMPDIR'}. Is the disk full?",
|
||||
"Change \$TMPDIR with --tmpdir or use --compress.");
|
||||
$error_printed = 1;
|
||||
}
|
||||
::wait_and_exit(255);
|
||||
|
@ -4524,11 +4531,11 @@ sub compute_max_loadavg {
|
|||
close $in_fh;
|
||||
$load = $self->compute_max_loadavg($opt_load_file);
|
||||
} else {
|
||||
::error("Cannot open $loadspec.\n");
|
||||
::error("Cannot open $loadspec.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
} else {
|
||||
::error("Parsing of --load failed.\n");
|
||||
::error("Parsing of --load failed.");
|
||||
::die_usage();
|
||||
}
|
||||
if($load < 0.01) {
|
||||
|
@ -4730,8 +4737,8 @@ sub compute_number_of_processes {
|
|||
# It took more than 0.01 second to fork a processes on avg.
|
||||
# Give the user a warning. He can press Ctrl-C if this
|
||||
# sucks.
|
||||
::warning("Starting $system_limit processes took > $forktime sec.\n",
|
||||
"Consider adjusting -j. Press CTRL-C to stop.\n");
|
||||
::warning("Starting $system_limit processes took > $forktime sec.",
|
||||
"Consider adjusting -j. Press CTRL-C to stop.");
|
||||
$slow_spawining_warning_printed = 1;
|
||||
}
|
||||
}
|
||||
|
@ -4740,19 +4747,20 @@ sub compute_number_of_processes {
|
|||
if($system_limit < $wanted_processes) {
|
||||
# The system_limit is less than the wanted_processes
|
||||
if($system_limit < 1 and not $Global::JobQueue->empty()) {
|
||||
::warning("Cannot spawn any jobs. Raising ulimit -u or /etc/security/limits.conf\n",
|
||||
"or /proc/sys/kernel/pid_max may help.\n");
|
||||
::warning("Cannot spawn any jobs. Raising ulimit -u or /etc/security/limits.conf",
|
||||
"or /proc/sys/kernel/pid_max may help.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
if(not $more_filehandles) {
|
||||
::warning("Only enough file handles to run ", $system_limit, " jobs in parallel.\n",
|
||||
"Running 'parallel -j0 -N", $system_limit, " --pipe parallel -j0' or ",
|
||||
"raising ulimit -n or /etc/security/limits.conf may help.\n");
|
||||
::warning("Only enough file handles to run ", $system_limit, " jobs in parallel.",
|
||||
"Running 'parallel -j0 -N $system_limit --pipe parallel -j0' or ".
|
||||
"raising ulimit -n or /etc/security/limits.conf may help.");
|
||||
}
|
||||
if($max_system_proc_reached) {
|
||||
::warning("Only enough available processes to run ", $system_limit,
|
||||
" jobs in parallel. Raising ulimit -u or /etc/security/limits.conf\n",
|
||||
"or /proc/sys/kernel/pid_max may help.\n");
|
||||
::warning("Only enough available processes to run ". $system_limit.
|
||||
" jobs in parallel.",
|
||||
"Raising ulimit -u or /etc/security/limits.conf ",
|
||||
"or /proc/sys/kernel/pid_max may help.");
|
||||
}
|
||||
}
|
||||
if($] == 5.008008 and $system_limit > 1000) {
|
||||
|
@ -4788,12 +4796,12 @@ sub simultaneous_sshlogin_limit {
|
|||
$self->simultaneous_sshlogin($wanted_processes));
|
||||
if($ssh_limit < $wanted_processes) {
|
||||
my $serverlogin = $self->serverlogin();
|
||||
::warning("ssh to $serverlogin only allows ",
|
||||
"for $ssh_limit simultaneous logins.\n",
|
||||
"You may raise this by changing ",
|
||||
"/etc/ssh/sshd_config:MaxStartups and MaxSessions on $serverlogin.\n",
|
||||
"Using only ",$ssh_limit-1," connections ",
|
||||
"to avoid race conditions.\n");
|
||||
::warning("ssh to $serverlogin only allows ".
|
||||
"for $ssh_limit simultaneous logins.",
|
||||
"You may raise this by changing ".
|
||||
"/etc/ssh/sshd_config:MaxStartups and MaxSessions on $serverlogin.",
|
||||
"Using only ".($ssh_limit-1)." connections ".
|
||||
"to avoid race conditions.");
|
||||
}
|
||||
# Race condition can cause problem if using all sshs.
|
||||
if($ssh_limit > 1) { $ssh_limit -= 1; }
|
||||
|
@ -4863,11 +4871,11 @@ sub user_requested_processes {
|
|||
close $in_fh;
|
||||
$processes = $self->user_requested_processes($opt_P_file);
|
||||
} else {
|
||||
::error("Cannot open $opt_P.\n");
|
||||
::error("Cannot open $opt_P.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
} else {
|
||||
::error("Parsing of --jobs/-j/--max-procs/-P failed.\n");
|
||||
::error("Parsing of --jobs/-j/--max-procs/-P failed.");
|
||||
::die_usage();
|
||||
}
|
||||
$processes = ::ceil($processes);
|
||||
|
@ -4899,8 +4907,8 @@ sub ncpus {
|
|||
if($ncpu =~ /^\s*[0-9]+\s*$/s) {
|
||||
$self->{'ncpus'} = $ncpu;
|
||||
} else {
|
||||
::warning("Could not figure out ",
|
||||
"number of cpus on $serverlogin ($ncpu). Using 1.\n");
|
||||
::warning("Could not figure out ".
|
||||
"number of cpus on $serverlogin ($ncpu). Using 1.");
|
||||
$self->{'ncpus'} = 1;
|
||||
}
|
||||
}
|
||||
|
@ -4961,7 +4969,7 @@ sub no_of_cpus {
|
|||
chomp $no_of_cpus;
|
||||
return $no_of_cpus;
|
||||
} else {
|
||||
::warning("Cannot figure out number of cpus. Using 1.\n");
|
||||
::warning("Cannot figure out number of cpus. Using 1.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -5018,7 +5026,7 @@ sub no_of_cores {
|
|||
chomp $no_of_cores;
|
||||
return $no_of_cores;
|
||||
} else {
|
||||
::warning("Cannot figure out number of CPU cores. Using 1.\n");
|
||||
::warning("Cannot figure out number of CPU cores. Using 1.");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
@ -5460,7 +5468,7 @@ sub rsync_transfer_cmd {
|
|||
my $file = shift;
|
||||
my $workdir = shift;
|
||||
if(not -r $file) {
|
||||
::warning($file, " is not readable and will not be transferred.\n");
|
||||
::warning($file. " is not readable and will not be transferred.");
|
||||
return "true";
|
||||
}
|
||||
my $rsync_destdir;
|
||||
|
@ -5599,10 +5607,10 @@ sub total_jobs {
|
|||
my $start = time;
|
||||
while($job = $self->get()) {
|
||||
if(time - $start > 10) {
|
||||
::warning("Reading ".scalar(@queue)." arguments took longer than 10 seconds.\n");
|
||||
$opt::eta && ::warning("Consider removing --eta.\n");
|
||||
$opt::bar && ::warning("Consider removing --bar.\n");
|
||||
$opt::shuf && ::warning("Consider removing --shuf.\n");
|
||||
::warning("Reading ".scalar(@queue)." arguments took longer than 10 seconds.");
|
||||
$opt::eta && ::warning("Consider removing --eta.");
|
||||
$opt::bar && ::warning("Consider removing --bar.");
|
||||
$opt::shuf && ::warning("Consider removing --shuf.");
|
||||
last;
|
||||
}
|
||||
push @queue, $job;
|
||||
|
@ -5792,13 +5800,13 @@ sub openoutputfiles {
|
|||
# prefix/name1/val1/name2/val2/stdout
|
||||
$outname = "$dir/stdout";
|
||||
if(not open($outfhw, "+>", $outname)) {
|
||||
::error("Cannot write to `$outname'.\n");
|
||||
::error("Cannot write to `$outname'.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
# prefix/name1/val1/name2/val2/stderr
|
||||
$errname = "$dir/stderr";
|
||||
if(not open($errfhw, "+>", $errname)) {
|
||||
::error("Cannot write to `$errname'.\n");
|
||||
::error("Cannot write to `$errname'.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
$self->set_fh(1,"unlink","");
|
||||
|
@ -6517,7 +6525,7 @@ sub sshlogin_wrap {
|
|||
push @vars, grep { not defined $ignore{$_} } keys %ENV;
|
||||
@vars = grep { not /^_$/ } @vars;
|
||||
} else {
|
||||
::error("Run '$Global::progname --record-env' in a clean environment first.\n");
|
||||
::error("Run '$Global::progname --record-env' in a clean environment first.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -6548,7 +6556,7 @@ sub sshlogin_wrap {
|
|||
if(@bashfunc) {
|
||||
# Functions are not supported for all shells
|
||||
if($Global::shell !~ m:/(bash|rbash|zsh|rzsh|dash|ksh):) {
|
||||
::warning("Shell functions may not be supported in $Global::shell\n");
|
||||
::warning("Shell functions may not be supported in $Global::shell.");
|
||||
}
|
||||
$bashfuncset =
|
||||
'@bash_functions=qw('."@bash_functions".");".
|
||||
|
@ -7006,13 +7014,13 @@ sub print_dryrun_and_verbose {
|
|||
# # FIFO for communicating exit val
|
||||
# my $tmpfifo = ::tmpfifo();
|
||||
if(length($tmpfifo) >=100) {
|
||||
::error("tmux does not support sockets with path > 100\n");
|
||||
::error("tmux does not support sockets with path > 100.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
my $visual_command = $self->replaced();
|
||||
my $title = $visual_command;
|
||||
if($visual_command =~ /\0/) {
|
||||
::error("Command line contains NUL. tmux is confused by NUL.\n");
|
||||
::error("Command line contains NUL. tmux is confused by NUL.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
# ; causes problems
|
||||
|
@ -7229,7 +7237,7 @@ sub files_print {
|
|||
# If the job is dead: close printing fh. Needed for --compress
|
||||
close $self->fh($fdno,"w");
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::compress_program." failed.\n");
|
||||
::error($opt::compress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
if($opt::compress) {
|
||||
|
@ -7260,7 +7268,7 @@ sub linebuffer_print {
|
|||
# If the job is dead: close printing fh. Needed for --compress
|
||||
close $self->fh($fdno,"w");
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::compress_program." failed.\n");
|
||||
::error($opt::compress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
if($opt::compress) {
|
||||
|
@ -7330,7 +7338,7 @@ sub linebuffer_print {
|
|||
# decompress done: close fh
|
||||
close $in_fh;
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::decompress_program." failed.\n");
|
||||
::error($opt::decompress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
}
|
||||
|
@ -7343,7 +7351,7 @@ sub tag_print {
|
|||
my $buf;
|
||||
close $self->fh($fdno,"w");
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::compress_program." failed.\n");
|
||||
::error($opt::compress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
seek $in_fh, 0, 0;
|
||||
|
@ -7373,7 +7381,7 @@ sub tag_print {
|
|||
}
|
||||
close $in_fh;
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::decompress_program." failed.\n");
|
||||
::error($opt::decompress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
}
|
||||
|
@ -7384,7 +7392,7 @@ sub normal_print {
|
|||
my $buf;
|
||||
close $self->fh($fdno,"w");
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::compress_program." failed.\n");
|
||||
::error($opt::compress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
seek $in_fh, 0, 0;
|
||||
|
@ -7407,7 +7415,7 @@ sub normal_print {
|
|||
}
|
||||
close $in_fh;
|
||||
if($? and $opt::compress) {
|
||||
::error($opt::decompress_program." failed.\n");
|
||||
::error($opt::decompress_program." failed.");
|
||||
$self->set_exitstatus(255);
|
||||
}
|
||||
}
|
||||
|
@ -7672,15 +7680,15 @@ sub populate {
|
|||
last;
|
||||
} else {
|
||||
my $args = join(" ", map { $_->orig() } @$next_arg);
|
||||
::error("Command line too long (",
|
||||
$self->len(), " >= ",
|
||||
$max_len,
|
||||
") at input ",
|
||||
$self->{'arg_queue'}->arg_number(),
|
||||
::error("Command line too long (".
|
||||
$self->len(). " >= ".
|
||||
$max_len.
|
||||
") at input ".
|
||||
$self->{'arg_queue'}->arg_number().
|
||||
": ".
|
||||
((length $args > 50) ?
|
||||
(substr($args,0,50))."...\n" :
|
||||
$args."\n"));
|
||||
(substr($args,0,50))."..." :
|
||||
$args));
|
||||
$self->{'arg_queue'}->unget($self->pop());
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
|
@ -8126,7 +8134,7 @@ sub new {
|
|||
# Is this really a command in $PATH starting with '-'?
|
||||
my $cmd = $1;
|
||||
if(not ::which($cmd)) {
|
||||
::error("Command ($cmd) starts with '-'. Is this a wrong option?\n");
|
||||
::error("Command ($cmd) starts with '-'. Is this a wrong option?");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -8140,7 +8148,7 @@ sub new {
|
|||
(defined $opt::tagstring ? $opt::tagstring : $dummy)) {
|
||||
# Disallow \257 to avoid nested {= {= =} =}
|
||||
if(/\257/) {
|
||||
::error("Command cannot contain the character \257. Use a function for that.\n");
|
||||
::error("Command cannot contain the character \257. Use a function for that.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
# Needs to match rightmost left parens (Perl defaults to leftmost)
|
||||
|
@ -8337,7 +8345,7 @@ sub get {
|
|||
if($opt::pipe or $opt::pipepart) {
|
||||
if($cmd_line->replaced() eq "") {
|
||||
# Empty command - pipe requires a command
|
||||
::error("--pipe must have a command to pipe into (e.g. 'cat').\n");
|
||||
::error("--pipe must have a command to pipe into (e.g. 'cat').");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
} else {
|
||||
|
@ -8412,8 +8420,7 @@ sub max_length {
|
|||
if($opt::max_chars <= $cached_limit) {
|
||||
$Limits::Command::line_max_len = $opt::max_chars;
|
||||
} else {
|
||||
::warning("Value for -s option ",
|
||||
"should be < $cached_limit.\n");
|
||||
::warning("Value for -s option should be < $cached_limit.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8477,7 +8484,7 @@ sub tmux_length {
|
|||
if($opt::tmux) {
|
||||
$ENV{'TMUX'} ||= "tmux";
|
||||
if(not ::which($ENV{'TMUX'})) {
|
||||
::error($ENV{'TMUX'}." not found in \$PATH.\n");
|
||||
::error($ENV{'TMUX'}." not found in \$PATH.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
my @out;
|
||||
|
@ -8630,9 +8637,9 @@ sub new {
|
|||
my $fhs = shift;
|
||||
for my $fh (@$fhs) {
|
||||
if(-t $fh) {
|
||||
::warning("Input is read from the terminal.\n");
|
||||
::warning("Only experts do this on purpose. ".
|
||||
"Press CTRL-D to exit.\n");
|
||||
::warning("Input is read from the terminal.",
|
||||
"Only experts do this on purpose. ".
|
||||
"Press CTRL-D to exit.");
|
||||
}
|
||||
}
|
||||
return bless {
|
||||
|
@ -8865,7 +8872,7 @@ sub new {
|
|||
# We found hostgroups on the arg
|
||||
@hostgroups = split(/\+/, $1);
|
||||
if(not grep { defined $Global::hostgroups{$_} } @hostgroups) {
|
||||
::warning("No such hostgroup (@hostgroups)\n");
|
||||
::warning("No such hostgroup (@hostgroups).");
|
||||
@hostgroups = (keys %Global::hostgroups);
|
||||
}
|
||||
} else {
|
||||
|
@ -8908,7 +8915,7 @@ sub new {
|
|||
# All is good
|
||||
} else {
|
||||
# The eval failed. Maybe $perlexpr is invalid perl?
|
||||
::error("Cannot use $perlexpr: $@\n");
|
||||
::error("Cannot use $perlexpr: $@");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
@ -8942,7 +8949,7 @@ sub trim_of {
|
|||
} elsif($Global::trim eq "rl" or $Global::trim eq "lr") {
|
||||
for my $arg (@strings) { $arg =~ s/^\s+//; $arg =~ s/\s+$//; }
|
||||
} else {
|
||||
::error("--trim must be one of: r l rl lr.\n");
|
||||
::error("--trim must be one of: r l rl lr.");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
return wantarray ? @strings : "@strings";
|
||||
|
@ -9114,7 +9121,7 @@ sub acquire {
|
|||
and
|
||||
time - $start_time > $opt::semaphoretimeout) {
|
||||
# Timeout: Take the semaphore anyway
|
||||
::warning("Semaphore timed out. Stealing the semaphore.\n");
|
||||
::warning("Semaphore timed out. Stealing the semaphore.");
|
||||
if(not -e $self->{'idfile'}) {
|
||||
open (my $fh, ">", $self->{'idfile'}) or
|
||||
::die_bug("timeout_write_idfile: $self->{'idfile'}");
|
||||
|
@ -9127,7 +9134,7 @@ sub acquire {
|
|||
and
|
||||
time - $start_time > -$opt::semaphoretimeout) {
|
||||
# Timeout: Exit
|
||||
::warning("Semaphore timed out. Exiting.\n");
|
||||
::warning("Semaphore timed out. Exiting.");
|
||||
exit(1);
|
||||
last;
|
||||
}
|
||||
|
@ -9216,8 +9223,8 @@ sub lock {
|
|||
last;
|
||||
} else {
|
||||
if ($! =~ m/Function not implemented/) {
|
||||
::warning("flock: $!");
|
||||
::warning("Will wait for a random while\n");
|
||||
::warning("flock: $!",
|
||||
"Will wait for a random while.");
|
||||
::usleep(rand(5000));
|
||||
# File cannot be locked: No need to retry
|
||||
$locked = 2;
|
||||
|
@ -9276,7 +9283,7 @@ sub mkdir_or_die {
|
|||
mkdir $ddir;
|
||||
}
|
||||
if(not -w $dir) {
|
||||
::error("Cannot write to $dir: $!\n");
|
||||
::error("Cannot write to $dir: $!");
|
||||
::wait_and_exit(255);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue