libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: win32 short name and IFS='~'


From: Boehne, Robert
Subject: RE: win32 short name and IFS='~'
Date: Thu, 17 Apr 2003 14:49:45 -0500

Naofumi,

#! /bin/sh
# How about ditching use of IFS totally in favor of a series of commands
# to be executed.  For example, we currently use
show="echo"
run=

test_cmds='echo "do command one"~echo "do command two"~echo "do command three"'

#then, rather than do this:
        save_ifs="$IFS"; IFS='~'
        for cmd in $test_cmds; do
          IFS="$save_ifs"
          $show "$cmd"
          $run eval "$cmd" || exit $?
        done
        IFS="$save_ifs"

# suppose we used
archive_cmds_1='echo "do command one"'
archive_cmds_2='echo "do command two"'
archive_cmds_3='echo "do command three"'
archvie_cmds_max=3

echo " We would do something like this: "
n=0
cmd=
while true; do
  n=`expr $n + 1`
  cmd="\$archive_cmds_$n"
  if test $n -le $archvie_cmds_max ; then
    $show "$cmd"
    $run eval "$cmd" || exit $?
  else
    break;
  fi
done

The real trick to making this work is to get the
shell quoting exactly the same so that we can simply
take current command (~ separated lists) and convert them to
a series without changing the quoting.
The script above doesn't do this :(  but it can be used
by all to attempt to figure out the right quoting to
have the desired result.  This type of solution has
the distinct advantage of not using any other character
for IFS, and so cannot ever clash with characters in
commands.
I would also encourage the use of shell functions to
simplify this, or any other bit of libtool for that matter.

Thanks,

Robert



-----Original Message-----
From: Naofumi Yasufuku [mailto:address@hidden
Sent: Thursday, April 17, 2003 11:21 AM
To: Robert Boehne
Cc: Naofumi Yasufuku; address@hidden
Subject: Re: win32 short name and IFS='~'


Robert,

I really hope this '~' IFS problem will be solved by next stable release.

Regards,
--Naofumi


At Wed, 09 Apr 2003 17:02:55 +0900,
Naofumi Yasufuku wrote:
> 
> [1  <text/plain; US-ASCII (7bit)>]
> At Fri, 04 Apr 2003 14:21:36 +0900,
> Naofumi Yasufuku wrote:
> > 
> > At Thu, 03 Apr 2003 22:49:49 -0600,
> > Robert Boehne wrote:
> > > 
> > > Naofumi,
> > > 
> > > This doesn't look safe to me at all, I would prefer to change over
> > > to ? rather than change how these delicate shell expansions are handled.
> > > I'm going to try ? and see how it goes.
> > > 
> > 
> > '?' could be used in the command expressions (e.g. $?, ${var:?word}).
> > If you can assure that '?' will never used in the command expressions,
> > it can be used as IFS.
> > 
> 
> I would suggest using a control character, for example, '' (RS:
> Record Separator, 0x1E).
> I believe that '' will never be used in command expressions and it
> doesn't affect m4 macro processing.
> 
> The following patch changes IFS='~' to IFS=''.
> I've tested it under MinGW/Cygwin and Linux using bash.
> 
> Could you please review this patch?
> 
> Regards,
> --Naofumi
> 
> 
> rs-ifs.patch:
> -------------------------------------------------------------------------------
[snip]



_______________________________________________
Libtool-patches mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/libtool-patches




reply via email to

[Prev in Thread] Current Thread [Next in Thread]