Project

General

Profile

Bug #11258

getconf is 1) bash-only, 2) buggy

Added by drzraf over 1 year ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Target version:
-
Start date:
03/17/2016
Due date:
% Done:

0%

QA Check:

Description

1) bash-only

More specifically:

ret="${ret//\\*/__star__}" 

(commented: "replace * with %, so that it is not globbed")

Either forget about /bin/sh and allow bash-ism everywhere (IMHO the best option)
Either fix it to make it compatible with /bin/sh

2) bugged :
\" (as an example) get replaced with star
Because quoted "${ret//\*/__star__}" replace the "\*" rather than simply "*"

ret='*'; echo "${ret//\\*/__star__}" # output * which is not stripped
ret='\*'; echo "${ret//\\*/__star__}" # outputs __start__ because of the \ prefix
ret='\'; echo "${ret//\\*/__star__}" # outputs __start__ because it applies to \
ret='\abcd'; echo "${ret//\\*/__star__}" # outputs __start__ because it applies up to EO

The expression, if it should ever exist, should be

${ret//\*/__star__}

(escaping with one \ the *)

Also available in: Atom PDF