file(1) no longer tells if a file is stripped (www/faq/ports/guide.html patch)

2015-11-10 Thread Adam Wolk

Hi tech@

http://www.openbsd.org/faq/ports/guide.html still suggests that file(1)
can be used to determine whether a file was stripped or not:

> Install the application with make fake. Libraries should never be
> stripped. Executables are stripped by default; this is governed by
> ${INSTALL_STRIP}. ${INSTALL_PROGRAM} honors this automatically and is
> preferable to unconditional stripping (e.g., by an install-strip
> target or by running strip from the Makefile). You can use file(1) to
> determine if a binary is stripped or not.

This is no longer true after the recent file(1) rewrite.

$ ls -alh camcell*
-rwxr-xr-x  1 mulander  mulander   127K Nov 10 20:43 camcell
-rwxr-xr-x  1 mulander  mulander  47.3K Nov 10 21:04 camcell_stripped
$ file camcell*
camcell:  ELF 64-bit LSB shared object, x86-64, version 1
camcell_stripped: ELF 64-bit LSB shared object, x86-64, version 1

I first wanted to write a patch for the docs to point to objdump(1)
with --syms flag but saw it stating:

>   --syms
>   Print the symbol table entries of the file.  This is similar
>   to the information provided by the nm program.

So I tried nm(1) but unfortunately even though a stripped binary on
Linux reports with nm(1):

mulander@inferno:~$ nm camcell_openbsd_stripped 
nm: camcell_openbsd_stripped: no symbols

On OpenBSD it still provides a lot of debugging symbols from shared
libs (as expected).

Hence I rewrote the docs to use objdump(1) with the --syms flag which
reports if the provided input binary was stripped of symbols like
initially intended.

Regards,
Adam Wolk

Index: guide.html
===
RCS file: /cvs/www/faq/ports/guide.html,v
retrieving revision 1.38
diff -u -p -r1.38 guide.html
--- guide.html  30 Jul 2015 10:56:41 -  1.38
+++ guide.html  10 Nov 2015 20:11:44 -
@@ -464,7 +464,8 @@ this is governed by ${INSTALL_STRIP}
 ${INSTALL_PROGRAM} honors this automatically and is preferable to
 unconditional stripping (e.g., by an install-strip target or by
 running strip from the Makefile).
-You can use file(1) to determine if a binary is stripped or not.
+You can use objdump(1) --syms to determine if a binary is stripped or not.
+Stripped files have no symbols in the SYMBOL TABLE.
 
 
 Check port for security holes again. This is



Re: file(1) no longer tells if a file is stripped (www/faq/ports/guide.html patch)

2015-11-10 Thread Stuart Henderson
On 2015/11/10 21:23, Adam Wolk wrote:
> Hence I rewrote the docs to use objdump(1) with the --syms flag which
> reports if the provided input binary was stripped of symbols like
> initially intended.

Thanks, diff applied.