Bugs item #312183, was changed at 2009-12-24 15:59 by Freddy Vulto You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312183&group_id=100114
>Status: Closed Priority: 3 Submitted By: Ville Skyttä (scop-guest) Assigned to: Freddy Vulto (fvu-guest) Summary: printf -v not available in bash 3.0 Distribution: None Originally reported in: None Milestone: 2.0 Status: None Original bug number: Initial Comment: The -v argument to printf was added in bash 3.1-alpha1, it is not available in bash 3.0. Freddy, you have worked on the areas where printf -v is currently used, could you take a look? FWIW, I'm not opposed to bumping the minimum required version to 3.1 if this is not sanely fixable otherwise. (Or if it is fixable and you still have the testsuite running in cron, it'd be nice if it could be run with bash 3.0 as well...) ---------------------------------------------------------------------- >Comment By: Freddy Vulto (fvu-guest) Date: 2010-01-24 12:01 Message: I've updated http://wiki.debian.org/Teams/BashCompletion/Proposals/DropBash2Support and set the minimum required version of bash to bash 3.2.39. Bash 3.2.39 happens to be the minimal bash version on Debian-5.0.3, but is open for debate. ---------------------------------------------------------------------- Comment By: Freddy Vulto (fvu-guest) Date: 2010-01-10 23:24 Message: I tried emulating `printf -v': ---8<------------------------------------------------------------------- # Emulate `printf -v' if bash version < 3.1 # @param $1 string Variable name to printf to # @param $@ Remaining parameters for printf __vprintf() { if [[ ${BASH_VERSINFO[0]} -eq 3 && ${BASH_VERSINFO[1]} -eq 0 ]]; then local var=$1 shift eval $var=\"\$\(printf \"\...@\"\)\" else printf -v "$@" fi } # __vprintf() ---8<------------------------------------------------------------------- and compiled bash-3.00.16 to test things, but I found that on bash-3.0, compgen is behaving differently: test/fixtures/_filedir$ echo $BASH_VERSION 3.00.16(1)-release test/fixtures/_filedir$ compgen -f 'a\\\ b' test/fixtures/_filedir$ compared to bash-3.2: test/fixtures/_filedir$ echo $BASH_VERSION 3.2.39(1)-release test/fixtures/_filedir$ compgen -f 'a\\\ b/' a\ b/i test/fixtures/_filedir$ It seems these kind of differences are causing a lot of tests to fail: Running ./unit/_filedir.exp ... FAIL: f a\ b/ should show completions FAIL: f a\'b/ should show completions FAIL: f a\"b/ should show completions FAIL: f a\\b/ should show completions FAIL: f a\&b/ should show completions FAIL: f 'a b/ should show completions FAIL: f 'a"b/ should show completions FAIL: f 'a\b/ should show completions FAIL: f 'a&b/ should show completions FAIL: f "a\"b/ should show completions FAIL: f "a\b/ should show completions FAIL: f "a\\b/ should show completions FAIL: f2 a\ b/ should show completions FAIL: f2 a\'b/ should show completions FAIL: f2 a\"b/ should show completions FAIL: f2 a\\b/ should show completions FAIL: f2 a\&b/ should show completions FAIL: f2 'a b/ should show completions FAIL: f2 'a"b/ should show completions FAIL: f2 'a\b/ should show completions FAIL: f2 'a&b/ should show completions FAIL: f2 "a\"b/ should show completions FAIL: f2 "a\b/ should show completions FAIL: f2 "a\\b/ should show completions === unit Summary === # of expected passes 21 # of unexpected failures 24 If bash-3.0 isn't actively used, I don't feel the urge to pursue this differences and fix things for bash-3.0. So I'd like to propose that we raise the minimum requirements for bash-completion-2 from bash-3 to bash-3.1 or even bash-3.2? Regards, Freddy Vulto http://fvue.nl ---------------------------------------------------------------------- Comment By: Ville Skyttä (scop-guest) Date: 2009-12-26 14:04 Message: For Red Hat and friends distros, that would mean dropping support for RHEL 4 and earlier, which I think is acceptable. All Fedora releases with bash < 4 are EOL already. ---------------------------------------------------------------------- Comment By: Freddy Vulto (fvu-guest) Date: 2009-12-24 18:58 Message: Hmm, wasn't aware of this, I'm using bash-3.2. The nice thing of printf -v is that no subshell is required. If bash 3.0 needs to be supported maybe we can write a wrapper __vprintf, for example (non-executable code): __vprintf() { if bash-version < 3.1 then eval $1=\$(printf \"\$2\" \"\$3\") else printf -v "$1" "$2" "$3" fi } I don't know if we can safely set the minimum requirements to bash-3.1? Are there people on the mailing list how can say something about that? ---------------------------------------------------------------------- You can respond by visiting: https://alioth.debian.org/tracker/?func=detail&atid=413095&aid=312183&group_id=100114 _______________________________________________ Bash-completion-devel mailing list [email protected] http://lists.alioth.debian.org/mailman/listinfo/bash-completion-devel
