Fedora Account System
Red Hat Associate
Red Hat Customer
Description of problem: I've read script help message: configs.sh [-u userId] [-p password] [-port port] ... and I see there just tiny bug where configs.sh should be changed to real name of script. I recommend to use $0 param. And I've tried to do permutations of first 3 params because from that help message I expect that I can do that. Just this permutation passed: -u admin -p admin -port 8080 USERID=admin PASSWORD=admin PORT=:8080 ########## Performing 'GET' on (Site:core-site, Tag:version1415365175001) Others return help message: -u admin -port 8080 -p admin -p admin -u admin -port 8080 -p admin -port 8080 -u admin -port 8080 -p admin -u admin -port 8080 -u admin -p admin I recommend to use getopt utility to parse arguments. Version-Release number of selected component (if applicable): rhs-hadoop-install-2_29-1 How reproducible: 100% Actual results: Script cannot handle permutations of arguments. Expected results: All supported scripts will handle permutations of args where it is possible according help message. Additional info: perm.sh: #!/bin/bash for i in `cat x.txt`; do par=""; for c in `echo $i | sed -e 's/\(.\)/\1\n/g'`; do if [ $c == 'a' ]; then par="$par -u admin" fi if [ $c == 'b' ]; then par="$par -p admin" fi if [ $c == 'c' ]; then par="$par -port 8080" fi done; echo $par; ./ambari_config.sh $par get _hostname_ TestCluster core-site; done x.txt: file with permutations perm.awk for creating permutations: function permute(s, st, i, j, n, tmp) { n = split(s, item,//) if (st > n) { print s; return } for (i=st; i<=n; i++) { if (i != st) { tmp = item[st]; item[st] = item[i]; item[i] = tmp nextstr = item[1] for (j=2; j<=n; j++) nextstr = nextstr delim item[j] }else { nextstr = s } permute(nextstr, st+1) n = split(s, item, //) } } { permute($0,1) }
There is another subbug when user miss one argument: "./ambari_config.sh -p admin -p 8080 get" ... (-u admin is missed)
I haven't known that this script is deprecated. I think in this case wontfix is OK and I've filed BZ for removing deprecated scripts from package. I think errata problems cannot be solved like this. Please see bug 1162527