bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#61530: sha256sum check single file in a mutiple sha sum text file


From: Bernhard Voelker
Subject: bug#61530: sha256sum check single file in a mutiple sha sum text file
Date: Thu, 16 Feb 2023 00:21:24 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1

tag 61530 notabug
close 61530
stop

On 2/15/23 14:28, Andreas Löw wrote:
    Hello,

    I want to check a single file for correct sha256. All the files of my
    directory are included in a sha256 text file named allsha256.

    The sha256sum always checks all files included in the allsha256 file,
    even if I write:

    sha256sum myfile -c allsha256

    It reports a warning 'no correct formatted line was found for myfile'
    and later it reports 'myfile OK'

    Regards,
    Andreas

The *sum utilities always check all files given in a checksum file(s).
That means once you've passed the -c option, the utility will treat all
further arguments as the name of files with checksums - no matter if the
file appears before or after the -c option:

  $ sha256sum README NEWS    > checksum1
  $ sha256sum TODO configure > checksum2
  $ sha256sum checksum1 -c checksum2
  README: OK
  NEWS: OK
  TODO: OK
  configure: OK

To achieve what you want, you have to pass only the checksum line of the
file you want, e.g.:

  $ grep myfile allsha256s | sha256sum -c -
  myfile: OK

Therefore, I'm hereby marking this as not-a-bug in our bug tracker.

Have a nice day,
Berny





reply via email to

[Prev in Thread] Current Thread [Next in Thread]