[FFmpeg-devel] [PATCH 1/3] configure: Support backslashes in TMPDIR on OS/2.

Dmitriy Kuminov coding at dmik.org
Sat Apr 16 19:22:19 CEST 2016


On 2016-04-16 04:39:44 +0000, KO Myung-Hun said:

>> diff --git a/configure b/configure
>> index 0ff1b9d..ff80aee 100755
>> --- a/configure
>> +++ b/configure
>> @@ -734,7 +734,12 @@ check_deps(){
>> 
>> print_config(){
>> pfx=$1
>> -    files=$2
>> +    if test "$host_os" = "os/2"; then
>> +        # awk treats \ as escape chars, convert them to / in paths
>> +        files=`echo "$2" | tr '\\\' /`
> 
> echoing back-slashes with echo is not portable. For example, on
> ksh-compatible shells such as pdksh and mksh, back-slashes are escaped
> by echo. Please use expr.

Ok, I checked that. Indeed, ksh and friends do escaping for the echo 
built-in by default (while e.g. ash and bash, as well as the external 
echo command don't). Expr looks like a nice alternative to echo but 
it's an external command... There is a way to avoid expr by doing 
something like

        files=$(tr \\\\ / <<EOF
$2
EOF
)

but that looks like a mouthful.

After some more thinking, I think this patch should be discarded at 
all. Backslases in paths in the Unix-like environment is a generic 
problem on OS/2. I'm pretty sure FFmpeg configure contains more places 
that use echo for path-like strings and therefore will produce 
incorrect results for paths with backslashes. I think that a proper 
solution is to patch shells to replace backslashes in path-like 
environment variables at the very beginnig of their execution. I will 
do that for ash and dash (that I maintain, see 
http://trac.netlabs.org/ports/ticket/104 for details).

As a temporary solution, one may do this in their enviroment before 
starting configure:

for v in PATH TEMP TMPDIR ; do
  eval "export $v=\$(expr \"\$$v\" | tr '\\\' /)"
done

-- 
Kind regards,
Dmitriy Kuminov
CPO of bww bitwise works GmbH




More information about the ffmpeg-devel mailing list