| Summary: | xargs: fails with "argument line too long" | ||
|---|---|---|---|
| Product: | Busybox | Reporter: | Steffen Nurpmeso <steffen> |
| Component: | Standard Compliance | Assignee: | unassigned |
| Status: | NEW --- | ||
| Severity: | blocker | CC: | busybox-cvs |
| Priority: | P5 | ||
| Version: | 1.29.x | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
| Attachments: | boiled down test script(s) | ||
|
Description
Steffen Nurpmeso
2018-10-26 22:16:36 UTC
Can you attach the text file and exact command which causes this?
xargs tar {what args here?} <FILE
Sigh, my mail did not get through? Copy and pasting the content, please wait:
Hmm, the backup script does
sub call{
unless(open HOOK, "| $HOOK " . ($COMPLETE || $RESET) .
" $^O >>$MFFN 2>&1"){
::err(1, "Failed to create hook pipe: $^E");
::do_exit(1)
}else{
my ($stop, $listref) = (0, Filelist::get_listref());
local *hdl = sub{ $stop = 1 };
local $SIG{PIPE} = \&hdl;
foreach my $p (@$listref){
last if $stop;
$p =~ s/\"/\"\\\"\"/g;
$p = '"' . $p . '"';
print HOOK $p, "\n"
}
}
close HOOK;
seek $MFFH, 0, 2
}
where $HOOK is an executable shell script.
The $HOOK then does (later on)
xargs tar -v -r -f "${HOME}/traffic/${backup}.tar" || {
rm -f "${HOME}/traffic/${backup}.tar"
echo >&2 'Failed 11'
exit 11
}
and that does exit 11. The "listref" above is an array of
absolute path names, and i did change the "print HOOK" to echo
some words first, and whereas the GNU xargs printed that three
times, the busybox one only once.
(And sorry for the late response, i have a new box and then
changed the old Apple box to native Linux, which turns out to be
very difficult for an inexperienced, and would plain fail without
the ArchLinux wiki -- thanks for that, whoever you are.)
> The $HOOK then does (later on) > > xargs tar -v -r -f "${HOME}/traffic/${backup}.tar" || { > rm -f "${HOME}/traffic/${backup}.tar" > echo >&2 'Failed 11' > exit 11 > } > > and that does exit 11. Insert ...| tee /tmp/FILE |... in a suitable location and thus save that input. No, sorry, no, this reveals the content of my entire file system? You cannot reproduce that, really? Well, i am still having no umlauts, and suspend does not really turn off cpu, and a fancontrol script is due, but thereafter i could find some time and look into that. Note this is a new box with likely shorter paths, on bare metal not in VM, i have no idea. (And i got no mail btw., i just looked because this on the plate) (In reply to Steffen Nurpmeso from comment #4) > You cannot reproduce that, really? Yes. I can pipe my entire output of "find /" to busybox xargs and it works. No error messages. Created attachment 7861 [details]
boiled down test script(s)
grrrr! Terrible!! Adding an attachment thrown away the text in this s....y textbox! once again... It is very strange it is that way, i can reproduce it absolutely reliably even on my new pretty virgin AlpineLinux (same version numbers)! I generated boiled down versions of my backup script and the currently used shell hook, you could unpack it in /tmp/ and it will send to $EMAIL the report of the failure, i would guess. It will try to backup /usr, which has 19418 files on this new box now. (I guess you look into the script yourself first anyway.) I would not know what is wrong with what i do, maybe a fd issue? (It needs an installed mail(1), or anyway "mail -s" must work, you surely look into that thing yourself!) I need a simple reproducer: a file which causes your xargs to go belly up. Not a multi-page perl script. Can you garble your secret filenames? A-la find /usr | tr '[a-z]' w | tr '[A-Z]' W | tr '[0-9]' 0 >FILE "--complete --reset" should have been used as arguments, sorry. Yes, i can! I will create the attachment with the original names from /usr/ in a second, and i can reproduce with "< .hooklist xargs echo bla". i cannot create the attachment, it is too large. ha-ha-ha. just run the script with "--complete --reset", it will not do any harm. i can tell you the list is "19533 19533 769751 114" says wc -lwcL. Actually it is really easy, just as you say: find /usr -type f | while read i; do printf "\"%s\"\n" "$i"; done | /bin/busybox xargs echo bla should do the trick. (And POSIX says that arguments may be quoted.) |