Created attachment 13161 [details] Patch to recognize the null device on MS-Windows On Unix, if you type "nm -B /dev/null", you get a nice warning: nm: Warning: '/dev/null' is not an ordinary file But on Windows no such warning happens, and 'nm' behaves as if the null device were a regular file of zero size. This is because the MS-Windows implementation of 'stat' doesn't report the null device as a character-special file, it reports it as a regular file. The attached file fixes this problem, and a similar problem in 'elfedit'.
Created attachment 13162 [details] A fixed patch Sorry, the original patch had a silly mistake; please use this on instead.
The master branch has been updated by Nick Clifton <nickc@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=a7ad3cb1fff75e8e11df40128adda66a42a06239 commit a7ad3cb1fff75e8e11df40128adda66a42a06239 Author: Eli Zaretskii <eliz@gnu.org> Date: Thu Jan 28 13:32:05 2021 +0000 Fix binutils tools so that they can cope with the special /dev/null file when run on Windows systems. PR 27252 * bucomm.c (get_file_size): Add code to handle /dev/null on Windows systems. * elfedit.c (check_file): Likewise.
Hi Eli, Thanks for the bug report and patch. I have now applied it to the mainline sources. Cheers Nick
Now that I see the changeset in Git, I realize that the comments in my patch include a typo: + /* MS-Windows 'stat' doesn't reports the null device as a + regular file; fix that. */ This should of course say MS-Windows 'stat' reports the null device as a regular file (This mistake is in both comments.) Sorry about that.
The master branch has been updated by Eli Zaretskii <eliz@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=887854bae4a3b7b1edc0b2f75a2781a8c31ba805 commit 887854bae4a3b7b1edc0b2f75a2781a8c31ba805 Author: Eli Zaretskii <eliz@gnu.org> Date: Fri Feb 5 09:05:58 2021 +0200 Fix typos in comments added in PR 27252 fix PR 27252 * elfedit.c (check_file): * bucomm.c (get_file_size): Fix typos in comments.
I took the liberty of fixing the typo in comments myself. Hope this is okay.