On Thursday, July 26 2018, GSR wrote: > sergi...@debian.org (2018-07-26 at 0008.50 -0400): >> Sorry, I'm not sure I understand the problem. The '-o' option works as >> expected here: >> >> $ bash /usr/bin/gcore 21153 >> 0x00007f11fc3d0404 in __GI___nanosleep (requested_time=0x7ffc3cb70240, >> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28 >> 28 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory. >> Saved corefile core.21153 >> >> $ bash /usr/bin/gcore -o blabla 21258 >> 0x00007f3531233404 in __GI___nanosleep (requested_time=0x7fff80925a40, >> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28 >> 28 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory. >> Saved corefile blabla.21258 >> >> $ bash /usr/bin/gcore -o blabla 21549 21550 >> 0x00007fc267908404 in __GI___nanosleep (requested_time=0x7ffc76bc1c80, >> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28 >> 28 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory. >> Saved corefile blabla.21549 >> 0x00007fab24ce5404 in __GI___nanosleep (requested_time=0x7ffc2d80a380, >> remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:28 >> 28 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory. >> Saved corefile blabla.21550 > > The man page says you can ask for filename blabla, then uses > blabla.21258. That is the problem, it's not a filename, more like a > template, and between getting blabla.21258 or core.21258, no big win, > IMO. If it needs extra handling to end in the file you really wanted, > probably you can rename any of them, or wrap with pushd/popd to change > directory. > > Compare also to many other programs, when they talk about a file or > filename, they normally use what is provided, unchanged. wget -i -o -a > and -O, sed -f, etc. wget doesn't force url files to end in .url, or > logging ones in .log, or ... You want to use .txt or no extension? All > work. You can even feed device names or connect to processes if the > shell supports "making files". They are flexible. > > Thing talks about filename, I expect filename result, not that it > magically means template. Just as mayority of programs do.
Ah, OK, now I understand. Indeed, I think the manpage could be extended to explain that "filename" is actually a prefix. >> > Suggestions: >> > >> > - change man page and -h output to say "pid[s]". >> >> This change would be welcome, IMO. > > See patches... manpage one is probably moot, if generated from other > source, but could be used as reference. I have a patch here to clarify the manpage. I think it's the best approach. > Other option is simplifying the script, and users do multiple calls, > one per PID. Which I guess it was how it worked before as that is the > man page "tone" (process, not processes, pid, not pids, etc). Doing a bit of archaeology, it's possible to verify that the script was introduced by: commit 627bf7c1c73e713199b020c66973629ddcb8cc59 Author: Elena Zannoni <ezann...@kwikemart.cygnus.com> Date: Thu Apr 17 20:33:09 2003 +0000 and it's also possible to confirm that the loop was always present. Ever since I started working on GDB I noticed that the gcore script is a bit "forgotten". >> > - support single PID with exact filename (no .pid extension). If you >> > can get a list of PIDs, you can also probably do the loop, so the >> > feature isn't so helpful but more importantly it disallows things >> > like '-o >( gzip - > "path/${PID}.gz" )' (on the fly compression) or >> > '-o "$T"' (a safe T created by tempfile(1)). >> > >> > - fix man page for -o "write core file to filename if one PID, or >> > filename.pid if multiple PIDs, instead of default core.pid". >> >> I don't really understand the two proposals above. > > IOW: If you ask for a file to be used, it should be that one when > possible (single PID case), not something else. "Do what I say, > cooperate". And document that. Honestly, I don't think this bug is important enough to justify complicating the script. I'll send the upstream patch to clarify the manpage (and Cc you); I hope this is enough to address the issue. Thanks, -- Sergio GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36 Please send encrypted e-mail if possible http://sergiodj.net/
signature.asc
Description: PGP signature