<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: binary files differ by time in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214734#M714337</link>
    <description>you change the ident string eachtime you modify the source.</description>
    <pubDate>Wed, 10 Mar 2004 16:47:02 GMT</pubDate>
    <dc:creator>Laurent Menase</dc:creator>
    <dc:date>2004-03-10T16:47:02Z</dc:date>
    <item>
      <title>binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214725#M714328</link>
      <description>The following sequence shows the dilema on hpux 11.00 and 11i for both cc and gcc. One of my application procedure requires that cksum give the same result. Is there a way to conform?&lt;BR /&gt;&lt;BR /&gt;Jun&lt;BR /&gt;&lt;BR /&gt;cc hello.c&lt;BR /&gt;mv a.out b.out&lt;BR /&gt;cc hello.c&lt;BR /&gt;diff a.out b.out&lt;BR /&gt;Binary files a.out and b.out differ&lt;BR /&gt;# cksum a.out&lt;BR /&gt;1115578088 20732 a.out&lt;BR /&gt;# cksum b.out&lt;BR /&gt;2899230371 20732 b.out&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 10:18:48 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214725#M714328</guid>
      <dc:creator>Jun Zhang_4</dc:creator>
      <dc:date>2004-03-10T10:18:48Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214726#M714329</link>
      <description>This is not easily "doable". Cksum and sum don't care about the file's metadata (ownership, group, mode, and timestamps); these commands simply don't even look at the metadata in the inode. However, your problem does have to do with timestamps --- just not the ones that you are able to see with ls.&lt;BR /&gt;You can convince yourself of this by doing this:&lt;BR /&gt;cp a.out b.out&lt;BR /&gt;cksum a.out b.out&lt;BR /&gt;&lt;BR /&gt;Eventhough the files have different timestamps (and even the owner/group could be different, if you like), the cksums are identical. Again, cksum, sum, and diff don't care about a file's metadata.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;The timestamp that is giving you problems is embedded in the executable (and indeed in the object files that built the executable).&lt;BR /&gt;There is a struct within (file_time) the file header of every object file that carries&lt;BR /&gt;the time of assembly or linking. Because to cksum this is DATA rather than METADATA, your task is hopeless. You could write a c program to modify this file_time data but that is the only way to accomplish what you are trying to do. &lt;BR /&gt;&lt;BR /&gt;Man a.out for details.&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 10:45:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214726#M714329</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-10T10:45:20Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214727#M714330</link>
      <description>Thank you for your reply.&lt;BR /&gt;So far I saw only hpux has this problem. &lt;BR /&gt;Do you think compile cc or gcc from source make a difference? Or some insight about what HP did to make cksum see different things will be helpful.&lt;BR /&gt;Also what the difference between an elf file and the PA-RISC executable, or can one generate elf file instead of PA-RISC on hpux?&lt;BR /&gt;Same procedure on a linux machine I got perfect agreement for diff and cksum.&lt;BR /&gt;&lt;BR /&gt;Jun</description>
      <pubDate>Wed, 10 Mar 2004 11:15:26 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214727#M714330</guid>
      <dc:creator>Jun Zhang_4</dc:creator>
      <dc:date>2004-03-10T11:15:26Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214728#M714331</link>
      <description>This is not really a "problem". Cksum is just doing what it is supposed to do. The files are different. It is common for many implementaions to leave the two-word sys_clock struct with zero'ed data indicating that the data are unused and that is why "cksum" works for other implementations. I don't know about ELF formats nor have I tried gcc. The problem is that you are using a tool that looks for any differences and you really want it to look for only significant differences. Cksum, sum, diff, et al have no way of doing that.&lt;BR /&gt;Moreover, even if the executables are identical, that still does not mean that the run-times are identical because different versions of shared libraries might be employed.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 11:48:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214728#M714331</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-10T11:48:25Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214729#M714332</link>
      <description>just try a&lt;BR /&gt;&lt;BR /&gt;cmp -l a.out b.out&lt;BR /&gt;&lt;BR /&gt;you will see the 4 words of modification.&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 12:18:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214729#M714332</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-03-10T12:18:51Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214730#M714333</link>
      <description>you can do a&lt;BR /&gt;odump -auxheader  a.out |grep when_linked&lt;BR /&gt;when_linked =   Wed Mar 10 2004 06:15:31.000000000 MET&lt;BR /&gt;when_linked =   Wed Jun 05 2002 19:39:30.000000000 METDST&lt;BR /&gt;&lt;BR /&gt;odump -compunit  a.out |grep Time&lt;BR /&gt;odump -compunit  b.out |grep Time&lt;BR /&gt;&lt;BR /&gt;The best to differenciate executables is to use a what string:&lt;BR /&gt;         char ident[] = "@(#)identification information";&lt;BR /&gt;then you can differenciate with &lt;BR /&gt;what a.out&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 12:30:56 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214730#M714333</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-03-10T12:30:56Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214731#M714334</link>
      <description>Since now we can differentiate the executables compiled at different times using the same source, command line options and user environment (appreciate it!),&lt;BR /&gt;is there a way that the difference could be eliminated? either after or during the compilation? This is actually my purpose when raised the question.&lt;BR /&gt;&lt;BR /&gt;Jun&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 14:41:37 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214731#M714334</guid>
      <dc:creator>Jun Zhang_4</dc:creator>
      <dc:date>2004-03-10T14:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214732#M714335</link>
      <description>In principle, you could rewrite the filehdr which begins at offset 0 and then examine each aux header which begin at a file offset specified by the aux_header_location field in the header and "fixup" each aux_header.&lt;BR /&gt;Note that aux_headers come in many different "flavors" so this it a bit tricky. I suspect, though I haven't bother to test this, is that the real differences are in the aux header because using od (and assuming I can count bytes) it appears that the file_time values are zero'ed in the header.&lt;BR /&gt;&lt;BR /&gt;Is this potentially dangerous? You bet. Is it in any sense useful? Beats me. Do the risks outweigh the benefits? I doubt it.&lt;BR /&gt;&lt;BR /&gt;You need to man a.out and read it this time and then look at /usr/include/filehdr.h. That will get you started. &lt;BR /&gt;&lt;BR /&gt;If this were me, I would put in the ident[] global string in one of the objects and trust it. &lt;BR /&gt;&lt;BR /&gt;If you are determined to do this then I would rethink the whole deal. You need to come up with a "checkexe" command that is platform specific. On most platforms it might just be a cksum wrapper. On HP-UX, you might open the exe, read the header and from that learn how many bytes in aux_headers you have and skip to that offset. Read the file from the end of the aux_headers to EOF and pipe that output to cksum. Now you ought to have two cksums that do compare. This still sounds like far more trouble than it is worth and you are still not addressing shared libraries.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 16:02:24 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214732#M714335</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-10T16:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214733#M714336</link>
      <description>I didn't get the point why adding the line&lt;BR /&gt;char ident[] = "@(#)identification information";&lt;BR /&gt;into hello.c. After added it,&lt;BR /&gt;what a.out&lt;BR /&gt;just give me one more line, and same to b.out. Where is the further differentiation of the two?&lt;BR /&gt;&lt;BR /&gt;Jun&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 16:31:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214733#M714336</guid>
      <dc:creator>Jun Zhang_4</dc:creator>
      <dc:date>2004-03-10T16:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214734#M714337</link>
      <description>you change the ident string eachtime you modify the source.</description>
      <pubDate>Wed, 10 Mar 2004 16:47:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214734#M714337</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-03-10T16:47:02Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214735#M714338</link>
      <description>ident serves as the "version of the file". It does require discipline on the part of the programmer to maintain it properly. Another method is to adopt the convention,&lt;BR /&gt;&lt;BR /&gt;myexe -V&lt;BR /&gt;&lt;BR /&gt;When -V is supplied print the version on stdout and exit. You have to supply the code to process the -V and adopt a convention for setting and maintaining a Version string. &lt;BR /&gt;&lt;BR /&gt;The -V convention also has the advantage that you can simply ask the user to execute a filename -V and read to you what it says.&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 10 Mar 2004 16:51:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214735#M714338</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-10T16:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: binary files differ by time</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214736#M714339</link>
      <description>I just made a script to copy the compunit and aux_header from one file to a copy of the second one,&lt;BR /&gt;then cmp.&lt;BR /&gt;This may help for  som files, but with no garanty&lt;BR /&gt;&lt;BR /&gt;#!/usr/bin/ksh&lt;BR /&gt;F1=$1&lt;BR /&gt;F2=$2&lt;BR /&gt;F2TMP=${2}tmp$$&lt;BR /&gt;cp $F2 $F2TMP&lt;BR /&gt;odump -header $1 |grep -e aux_header -e compiler |while read a b c d&lt;BR /&gt;do&lt;BR /&gt;  eval $(printf "dd bs=1 count=%d skip=%d of=%s if=%s\n" $c $b $a $F1)&lt;BR /&gt;  eval $(printf "dd bs=1  seek=%d if=%s 1&amp;lt;&amp;gt;%s\n"  $b $a $F2TMP)&lt;BR /&gt;done&lt;BR /&gt;&lt;BR /&gt;if cmp $F1 $F2TMP&lt;BR /&gt;then&lt;BR /&gt;  echo same&lt;BR /&gt;else&lt;BR /&gt;  cmp -l $F1 $F2TMP&lt;BR /&gt;fi&lt;BR /&gt;rm $F2TMP&lt;BR /&gt;&lt;BR /&gt;Laurent</description>
      <pubDate>Thu, 11 Mar 2004 03:57:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/binary-files-differ-by-time/m-p/3214736#M714339</guid>
      <dc:creator>Laurent Menase</dc:creator>
      <dc:date>2004-03-11T03:57:31Z</dc:date>
    </item>
  </channel>
</rss>

