Skip to content

cksum: --tag is meaningless with --check #7055

@RenjiSann

Description

@RenjiSann

(Found with fuzzer)

File content: /tmp/checksum_file=GVajpqCGFscY0d0ubfS5Wg==  /tmp/ghfmqwlkpt                                                                                                                                                                                                                  
                                                                                                                                                                                                                                                                                            
args: ["cksum", "--tag", "-c", "-a", "md5", "/tmp/muwfducico"]                                                                                                                                                                                                                              
Running test ["cksum", "--tag", "-c", "-a", "md5", "/tmp/muwfducico"]                                                                                                                                                                                                                       
Test Type: cksum                                                                                                                                                                                                                                                                            
Input: ["--tag", "-c", "-a", "md5", "/tmp/muwfducico"]                                                                                                                                                                                                                                      
Rust stderr: the argument '--tag' cannot be used with '--check'                                                                                                                                                                                                                             
                                                                                                                                                                                                                                                                                            
Usage: fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_cksum [OPTIONS] [FILE]...                                                                                                                                                                                                          
                                                                                                                                                                                                                                                                                            
For more information, try '--help'.                                                                                                                                                                                                                                                         
GNU stderr: the --binary and --text options are meaningless when verifying checksums                                                                                                                                                                                                        
Try 'cksum --help' for more information.                                                                                                                                                                                                                                                    
Diff=                                                                                                                                                                                                                                                                                       
-the argument '--tag' cannot be used with '--check'                                                                                                                                                                                                                                         
-                                                                                                                                                                                                                                                                                           
-Usage: fuzz/target/x86_64-unknown-linux-gnu/release/fuzz_cksum [OPTIONS] [FILE]...                                                                                                                                                                                                         
-                                                                                                                                                                                                                                                                                           
-For more information, try '--help'.                                                                                                                                                                                                                                                        
+the --binary and --text options are meaningless when verifying checksums                                                                                                                                                                                                                   
+Try 'cksum --help' for more information.                                                                                                                                                                                                                                                   
                                                                                                                                                                                                                                                                                            
Discrepancy detected: stderr differs                                                                                                                                                                                                                                                        
Test completed with discrepancies for cksum: ["--tag", "-c", "-a", "md5", "/tmp/muwfducico"]  

Here, we get clap to prevent the use of --tag with --check, rather than checking it ourselves and displaying the right message.
On this one, I think we could refine our message, to indicate that the operation is meaningless, but I feel like the GNU message is also wrong because it fails to correctly mention the faulty flag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions