mirror of
https://git.savannah.gnu.org/git/parallel.git
synced 2024-11-22 05:57:54 +00:00
parallel: Warn if the first 3 values end in \r\n (DOS newline).
This commit is contained in:
parent
c7d42df6c6
commit
f44eb31be6
31
src/parallel
31
src/parallel
|
@ -2155,7 +2155,7 @@ sub check_invalid_option_combinations() {
|
||||||
|
|
||||||
sub init_globals() {
|
sub init_globals() {
|
||||||
# Defaults:
|
# Defaults:
|
||||||
$Global::version = 20210201;
|
$Global::version = 20210202;
|
||||||
$Global::progname = 'parallel';
|
$Global::progname = 'parallel';
|
||||||
$::name = "GNU Parallel";
|
$::name = "GNU Parallel";
|
||||||
$Global::infinity = 2**31;
|
$Global::infinity = 2**31;
|
||||||
|
@ -3464,7 +3464,9 @@ sub init_run_jobs() {
|
||||||
::usleep(rand()*300);
|
::usleep(rand()*300);
|
||||||
::warning("No more processes: ".
|
::warning("No more processes: ".
|
||||||
"Decreasing number of running jobs to $max.",
|
"Decreasing number of running jobs to $max.",
|
||||||
"Raising ulimit -u or /etc/security/limits.conf may help.");
|
"Try increasing 'ulimit -u' (try: ulimit -u `ulimit -Hu`)",
|
||||||
|
"or increasing 'nproc' in /etc/security/limits.conf",
|
||||||
|
"or increasing /proc/sys/kernel/pid_max");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3472,7 +3474,10 @@ sub init_run_jobs() {
|
||||||
# No more file handles
|
# No more file handles
|
||||||
$no_more_file_handles_warned++ or
|
$no_more_file_handles_warned++ or
|
||||||
::warning("No more file handles. ",
|
::warning("No more file handles. ",
|
||||||
"Raising ulimit -n or /etc/security/limits.conf may help.");
|
"Try running 'parallel -j0 -N 100 --pipe parallel -j0'",
|
||||||
|
"or increasing 'ulimit -n' (try: ulimit -n `ulimit -Hn`)",
|
||||||
|
"or increasing 'nofile' in /etc/security/limits.conf",
|
||||||
|
"or increasing /proc/sys/fs/file-max");
|
||||||
debug("start", "No more file handles. ");
|
debug("start", "No more file handles. ");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -11553,7 +11558,6 @@ sub new($) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add {} if no replacement strings in @command
|
# Add {} if no replacement strings in @command
|
||||||
($replacecount_ref, $len_ref, @command) =
|
($replacecount_ref, $len_ref, @command) =
|
||||||
replacement_counts_and_lengths($transfer_files,$return_files,@command);
|
replacement_counts_and_lengths($transfer_files,$return_files,@command);
|
||||||
|
@ -12297,6 +12301,10 @@ sub nest_get($) {
|
||||||
return shift @{$self->{'unget'}};
|
return shift @{$self->{'unget'}};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
my $cr_count = 0;
|
||||||
|
my $nl_count = 0;
|
||||||
|
my $dos_crnl_determined;
|
||||||
sub read_arg_from_fh($) {
|
sub read_arg_from_fh($) {
|
||||||
# Read one Arg from filehandle
|
# Read one Arg from filehandle
|
||||||
# Returns:
|
# Returns:
|
||||||
|
@ -12315,6 +12323,20 @@ sub read_arg_from_fh($) {
|
||||||
return undef;
|
return undef;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(not $dos_crnl_determined and not $opt::d) {
|
||||||
|
# Warn if input has CR-NL and -d is not set
|
||||||
|
if($arg =~ /\r$/) {
|
||||||
|
$cr_count++;
|
||||||
|
} else {
|
||||||
|
$nl_count++;
|
||||||
|
}
|
||||||
|
if($cr_count == 3 or $nl_count == 3) {
|
||||||
|
$dos_crnl_determined = 1;
|
||||||
|
if($nl_count == 0 and $cr_count == 3) {
|
||||||
|
::warning('The first three values end in CR-NL. Consider using -d "\r\n"');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if($opt::csv) {
|
if($opt::csv) {
|
||||||
# We need to read a full CSV line.
|
# We need to read a full CSV line.
|
||||||
if(($arg =~ y/"/"/) % 2 ) {
|
if(($arg =~ y/"/"/) % 2 ) {
|
||||||
|
@ -12369,6 +12391,7 @@ sub read_arg_from_fh($) {
|
||||||
::die_bug("multiread arg undefined");
|
::die_bug("multiread arg undefined");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
# Prototype forwarding
|
# Prototype forwarding
|
||||||
sub expand_combinations(@);
|
sub expand_combinations(@);
|
||||||
|
|
Loading…
Reference in a new issue