Purpose of what(1)

2014-12-31 Thread Adam Wolk
Hi misc@

I have a question regarding the what(1) command. In one interview I saw
Theo mentioning the what(1) utility:

 Two numbers exist for every component of OpenBSD. One number is the release 
 that the piece came in, ie. 2.8.

 The other number exists in each source file that was built. And that number 
 is also in each binary that was built 
 from those files. You can use the what(1) command to determine the revisions 
 of source files which make up 
 each binary.

The way I understood this I could use the what utility on a binary file
in the base OpenBSD system to see exactly which CVS revisions of
specific files composed into the resulting binary.

I tried using the tool on several base utilities like ssh, adventure, ls
etc. None of them produced any output except the executable name itself.

I took a look at the source and the manpage and saw that what this
utility really does is stepping through the binary in search of the
revision markup then printing out the stuff it found.

I tried the utility on all the files in /usr/bin/*, /bin/* and
/usr/lib/* and found that the only ones producing output (actual
revision markers and source files) are plain text shell scripts.
Additionally output is also produced for the kernel files (/bsd,
/bsd.sp, /bsd.rd).

From the manpage

 The what utility is compliant with the X/Open System Interfaces option of the 
 IEEE Std 1003.1-2008 (“POSIX.1”) specification.

I understand that this is part of POSIX but my question is: Is standard
compliance the sole purpose of the existence of this tool or was it
actually able to produce output for regular system binaries back in the
old days? In case of the latter - is there some kind of additional
stripping or a build step change that causes the information no longer
being embedded in the executables?

I'm not saying that something is broken, but really interested to know
what changed. Especially after seeing this URL
http://prefetch.net/blog/index.php/2005/05/17/fix-for-solaris-ssh-client-hangs/
showing the output of what(1) ran against OpenSSH on Solaris.

In case this matters. I'm running a i386 snapshot from 27-Dec-2014.

Regards,
-- 
  Adam Wolk
  adam.w...@koparo.com



Re: Purpose of what(1)

2014-12-31 Thread martin
Adam Wolk adam.w...@koparo.com wrote:

 Hi misc@
 
 I have a question regarding the what(1) command. In one interview I saw
 Theo mentioning the what(1) utility:
 
  Two numbers exist for every component of OpenBSD. One number is the release 
  that the piece came in, ie. 2.8.
 
  The other number exists in each source file that was built. And that number 
  is also in each binary that was built 
  from those files. You can use the what(1) command to determine the 
  revisions of source files which make up 
  each binary.
 
 The way I understood this I could use the what utility on a binary file
 in the base OpenBSD system to see exactly which CVS revisions of
 specific files composed into the resulting binary.
 
 I tried using the tool on several base utilities like ssh, adventure, ls
 etc. None of them produced any output except the executable name itself.
 
 I took a look at the source and the manpage and saw that what this
 utility really does is stepping through the binary in search of the
 revision markup then printing out the stuff it found.
 
 I tried the utility on all the files in /usr/bin/*, /bin/* and
 /usr/lib/* and found that the only ones producing output (actual
 revision markers and source files) are plain text shell scripts.
 Additionally output is also produced for the kernel files (/bsd,
 /bsd.sp, /bsd.rd).
 
 From the manpage
 
  The what utility is compliant with the X/Open System Interfaces option of 
  the IEEE Std 1003.1-2008 (???POSIX.1???) specification.
 
 I understand that this is part of POSIX but my question is: Is standard
 compliance the sole purpose of the existence of this tool or was it
 actually able to produce output for regular system binaries back in the
 old days? In case of the latter - is there some kind of additional
 stripping or a build step change that causes the information no longer
 being embedded in the executables?
 
 I'm not saying that something is broken, but really interested to know
 what changed. Especially after seeing this URL
 http://prefetch.net/blog/index.php/2005/05/17/fix-for-solaris-ssh-client-hangs/
 showing the output of what(1) ran against OpenSSH on Solaris.
 
 In case this matters. I'm running a i386 snapshot from 27-Dec-2014.
 
 Regards,
 -- 
   Adam Wolk
   adam.w...@koparo.com

The tools work as you found, but there's nothing in the binaries to find
anymore.

They went through and removed the RCS/SCCS strings. See the commit
message here


http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/cat/cat.c?rev=1.20content-type=text/x-cvsweb-markup

Though CVS does still update the RCS string in the comment at the top of
the file.

I don't know what use what(1)/ident(1) still have in base other than
historically being there.

-- Martin



Re: Purpose of what(1)

2014-12-31 Thread Adam Wolk
On Wed, Dec 31, 2014, at 08:48 PM, mar...@martinbrandenburg.com wrote:
 Adam Wolk adam.w...@koparo.com wrote:
 
  Hi misc@
  
  I have a question regarding the what(1) command. In one interview I saw
  Theo mentioning the what(1) utility:
  
   Two numbers exist for every component of OpenBSD. One number is the 
   release that the piece came in, ie. 2.8.
  
   The other number exists in each source file that was built. And that 
   number is also in each binary that was built 
   from those files. You can use the what(1) command to determine the 
   revisions of source files which make up 
   each binary.
  
  The way I understood this I could use the what utility on a binary file
  in the base OpenBSD system to see exactly which CVS revisions of
  specific files composed into the resulting binary.
  
  I tried using the tool on several base utilities like ssh, adventure, ls
  etc. None of them produced any output except the executable name itself.
  
  I took a look at the source and the manpage and saw that what this
  utility really does is stepping through the binary in search of the
  revision markup then printing out the stuff it found.
  
  I tried the utility on all the files in /usr/bin/*, /bin/* and
  /usr/lib/* and found that the only ones producing output (actual
  revision markers and source files) are plain text shell scripts.
  Additionally output is also produced for the kernel files (/bsd,
  /bsd.sp, /bsd.rd).
  
  From the manpage
  
   The what utility is compliant with the X/Open System Interfaces option of 
   the IEEE Std 1003.1-2008 (???POSIX.1???) specification.
  
  I understand that this is part of POSIX but my question is: Is standard
  compliance the sole purpose of the existence of this tool or was it
  actually able to produce output for regular system binaries back in the
  old days? In case of the latter - is there some kind of additional
  stripping or a build step change that causes the information no longer
  being embedded in the executables?
  
  I'm not saying that something is broken, but really interested to know
  what changed. Especially after seeing this URL
  http://prefetch.net/blog/index.php/2005/05/17/fix-for-solaris-ssh-client-hangs/
  showing the output of what(1) ran against OpenSSH on Solaris.
  
  In case this matters. I'm running a i386 snapshot from 27-Dec-2014.
  
  Regards,
  -- 
Adam Wolk
adam.w...@koparo.com
 
 The tools work as you found, but there's nothing in the binaries to find
 anymore.
 
 They went through and removed the RCS/SCCS strings. See the commit
 message here
 
   
 http://cvsweb.openbsd.org/cgi-bin/cvsweb/src/bin/cat/cat.c?rev=1.20content-type=text/x-cvsweb-markup
 
 Though CVS does still update the RCS string in the comment at the top of
 the file.
 
 I don't know what use what(1)/ident(1) still have in base other than
 historically being there.
 
 -- Martin

Thanks Martin, you satisfied my curiosity - hope you have a happy new
year :)

Regards,
-- 
  Adam Wolk
  adam.w...@koparo.com