Package: ucf
Version: 3.0038

repro steps:

run with valid file arguments:

    # /usr/bin/ucf -n --debconf-ok /file1 /file2
    *** ERROR: Need exactly two arguments, got 3                                
                                                  

    Debian GNU/Linux ucf Revision: 3.00 .                                       
                                                  
               Copyright (C) 2002-2005 Manoj Srivastava.                        
                                                  
    This is free software; see the GNU General Public Licence for copying       
                                                  
    conditions.  There is NO warranty.                                          
                                                  

    Usage: ucf  [options] new_file  destination                                 
                                                  
    Options:                                                                    
                                                  
         -h,     --help          print this message                             
                                                  
         -s foo, --src-dir  foo  Set the src dir (historical md5sums live here) 
                                                  
                 --sum-file bar  Force the historical md5sums to be read from   
                                                  
                                 this file.  Overrides any setting of 
--src-dir.                                                  
         -d[n], --debug=[n]      Set the Debug level to N. Please note there 
must                                                 
                                 be no spaces before the debug level            
                                                  
         -n,     --no-action     Dry run. No action is actually taken.          
                                                  
         -v,     --verbose       Make the script verbose                        
                                                  
                 --three-way     Register this file in the cache, and turn on 
the                                                 
                                 diff3 option allowing the merging of 
maintainer                                                  
                                 changes into a (potentially modified) local    
                                                  
                                 configuration file. )                          
                                                  
                 --state-dir bar Set the state directory to bar instead of the  
                                                  
                                 default '/var/lib/ucf'. Used mostly for 
testing.                                                 
                 --debconf-ok    Indicate that it is ok for ucf to use an 
already                                                 
                                 running debconf instance for prompting.        
                                                  
                 --debconf-template bar                                         
                                                  
                                 Specify an alternate, caller-provided debconf  
                                                  
                                 template to use for prompting.                 
                                                  
    Usage: ucf  -p  destination                                                 
                                                  
         -p,     --purge         Remove any reference to destination from 
records                                                 

    By default, the directory the new_file lives in is assumed to be the 
src-dir,                                                 
    which is where we look for any historical md5sums.       


expected: does dry run as it should without error.

This is because it tries to save the -n argument then use it to call
itself again. But when saving the argument, it runs echo -n, expecting
the output to be -n, but it's actually an empty string, so it saves that
emptry string and passes that instead of -n.

Patch is attached.

--- ucf-3.0038/ucf	2018-02-25 19:58:23.000000000 -0500
+++ new/ucf	2018-03-07 16:42:55.727057127 -0500
@@ -308,7 +308,7 @@
 
 # Escape single quotes in the arguments passed in
 quote_single() {
-    echo "$1" | sed -e "s,','\\\\'',g"
+    printf "%s\n" "$1" | sed -e "s,','\\\\'',g"
 }
 
 
-- 
Ian Kelling | Senior Systems Administrator, Free Software Foundation
GPG Key: B125 F60B 7B28 7FF6 A2B7  DF8F 170A F0E2 9542 95DF
https://fsf.org | https://gnu.org

Reply via email to