[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: win32 short name and IFS='~'
From: |
Robert Boehne |
Subject: |
Re: win32 short name and IFS='~' |
Date: |
Thu, 03 Apr 2003 22:49:49 -0600 |
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.
Regards,
Robert
Naofumi Yasufuku wrote:
>
> Hi,
>
> Current libtool cannot treat win32 short name which contains '~'
> (e.g. -Lc:/progra~1/foo/lib). The cause of problem is command list
> separation by IFS='~'.
>
> # expand '~'-connected command list into $cmds
>
> eval cmds=\"$archive_expsym_cmds\" # $deplibs is expanded here
> ....
>
> # then separate & execute
>
> save_ifs="$IFS"; IFS='~'
> for cmd in $cmds; do
> IFS="$save_ifs"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> IFS="$save_ifs"
>
> If $deplibs contains "-Lc:/progra~1/foo/lib", $cmd is separated at
> invalid point "-Lc:/progra", so that $cmd fails.
>
> This patch solves above problem as follows.
>
> # set '~'-connected command list to $cmds (don't expand)
>
> cmds=$archive_expsym_cmds
> ....
>
> # separate, then expand & execute
>
> save_ifs="$IFS"; IFS='~'
> for cmd in $cmds; do
> IFS="$save_ifs"
> eval cmd=\"$cmd\" # $deplibs is expanded here
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> IFS="$save_ifs"
>
> I've tested under MinGW/Cygwin and Linux, and it works fine.
>
> Could anyone review this patch?
>
> Regards,
> --Naofumi
>
> ltmain.in-tilde-ifs.patch:
> -------------------------------------------------------------------------------
> Index: ChangeLog
> ===================================================================
> RCS file: /cvsroot/libtool/libtool/ChangeLog,v
> retrieving revision 1.1218
> diff -u -r1.1218 ChangeLog
> --- ChangeLog 3 Apr 2003 05:45:22 -0000 1.1218
> +++ ChangeLog 3 Apr 2003 06:56:28 -0000
> @@ -1,3 +1,10 @@
> +2003-04-03 Naofumi Yasufuku <address@hidden>
> +
> + * ltmain.in: Don't expand '~'-connected command list before its
> + separation. Now commands are expanded after separation by IFS='~'.
> + This change enables libtool to treat a directry name contains '~'
> + (e.g. -Lc:/progra~1/foo/lib) properly.
> +
> 2003-04-02 Robert Boehne <address@hidden>
>
> * tests/defs: Quote $DJGPP to prevent problems with some shells.
> Index: ltmain.in
> ===================================================================
> RCS file: /cvsroot/libtool/libtool/ltmain.in,v
> retrieving revision 1.334
> diff -u -r1.334 ltmain.in
> --- ltmain.in 2 Apr 2003 16:44:38 -0000 1.334
> +++ ltmain.in 3 Apr 2003 06:56:29 -0000
> @@ -2279,9 +2279,9 @@
> else
> $show "extracting exported symbol list from \`$soname'"
> save_ifs="$IFS"; IFS='~'
> - eval cmds=\"$extract_expsyms_cmds\"
> - for cmd in $cmds; do
> + for cmd in $extract_expsyms_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -2292,9 +2292,9 @@
> if test -f "$output_objdir/$newlib"; then :; else
> $show "generating import library for \`$soname'"
> save_ifs="$IFS"; IFS='~'
> - eval cmds=\"$old_archive_from_expsyms_cmds\"
> - for cmd in $cmds; do
> + for cmd in $old_archive_from_expsyms_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -3547,10 +3547,10 @@
> $show "generating symbol list for \`$libname.la'"
> export_symbols="$output_objdir/$libname.exp"
> $run $rm $export_symbols
> - eval cmds=\"$export_symbols_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $export_symbols_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> if len=`expr "X$cmd" : ".*"` &&
> test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1;
> then
> $show "$cmd"
> @@ -3667,19 +3667,20 @@
> # Do each of the archive commands.
> if test "$module" = yes && test -n "$module_cmds" ; then
> if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
> - eval cmds=\"$module_expsym_cmds\"
> + cmds=$module_expsym_cmds
> else
> - eval cmds=\"$module_cmds\"
> + cmds=$module_cmds
> fi
> else
> - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
> - eval cmds=\"$archive_expsym_cmds\"
> - else
> - eval cmds=\"$archive_cmds\"
> + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
> + cmds=$archive_expsym_cmds
> + else
> + cmds=$archive_cmds
> fi
> fi
>
> - if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
> + eval test_cmds=\"$cmds\"
> + if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"`
> &&
> test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
> :
> else
> @@ -3701,8 +3702,7 @@
>
> # Clear the reloadable object creation command queue and
> # initialize k to one.
> - test_cmds=
> - concat_cmds=
> + temp_cmds=
> objlist=
> delfiles=
> last_robj=
> @@ -3711,22 +3711,22 @@
> # Loop over the list of objects to be linked.
> for obj in $save_libobjs
> do
> - eval test_cmds=\"$reload_cmds $objlist $last_robj\"
> + eval temp_cmds=\"$reload_cmds $objlist $last_robj\"
> if test "X$objlist" = X ||
> - { len=`expr "X$test_cmds" : ".*"` &&
> + { len=`expr "X$temp_cmds" : ".*"` &&
> test "$len" -le "$max_cmd_len"; }; then
> objlist="$objlist $obj"
> else
> - # The command $test_cmds is almost too long, add a
> - # command to the queue.
> - if test "$k" -eq 1 ; then
> - # The first file doesn't have a previous command to add.
> - eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
> - else
> - # All subsequent reloadable object files will link in
> - # the last one created.
> - eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist
> $last_robj\"
> - fi
> + # The command $temp_cmds is almost too long, link piecewise.
> + temp_cmds="$reload_cmds \$objlist \$last_robj"
> + save_ifs="$IFS"; IFS='~'
> + for cmd in $temp_cmds; do
> + IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> + $show "$cmd"
> + $run eval "$cmd" || exit $?
> + done
> + IFS="$save_ifs"
> last_robj=$output_objdir/$save_output-${k}.$objext
> k=`expr $k + 1`
> output=$output_objdir/$save_output-${k}.$objext
> @@ -3737,16 +3737,30 @@
> # Handle the remaining objects by creating one last
> # reloadable object file. All subsequent reloadable object
> # files will link in the last one created.
> - test -z "$concat_cmds" || concat_cmds=$concat_cmds~
> - eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
> + temp_cmds="$reload_cmds \$objlist \$last_robj"
> + save_ifs="$IFS"; IFS='~'
> + for cmd in $temp_cmds; do
> + IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> + $show "$cmd"
> + $run eval "$cmd" || exit $?
> + done
> + IFS="$save_ifs"
>
> if ${skipped_export-false}; then
> $show "generating symbol list for \`$libname.la'"
> export_symbols="$output_objdir/$libname.exp"
> $run $rm $export_symbols
> libobjs=$output
> - # Append the command to create the export file.
> - eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
> + # Execute the command to create the export file.
> + save_ifs="$IFS"; IFS='~'
> + for cmd in $export_symbols_cmds; do
> + IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> + $show "$cmd"
> + $run eval "$cmd" || exit $?
> + done
> + IFS="$save_ifs"
> fi
>
> # Set up a command to remove the reloadale object files
> @@ -3758,17 +3772,6 @@
> delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
> done
>
> - $echo "creating a temporary reloadable object file: $output"
> -
> - # Loop through the commands generated above and execute them.
> - save_ifs="$IFS"; IFS='~'
> - for cmd in $concat_cmds; do
> - IFS="$save_ifs"
> - $show "$cmd"
> - $run eval "$cmd" || exit $?
> - done
> - IFS="$save_ifs"
> -
> libobjs=$output
> # Restore the value of output.
> output=$save_output
> @@ -3776,23 +3779,15 @@
> if test -n "$convenience" && test -n "$whole_archive_flag_spec";
> then
> eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
> fi
> - # Expand the library linking commands again to reset the
> - # value of $libobjs for piecewise linking.
> -
> - # Do each of the archive commands.
> - if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
> - eval cmds=\"$archive_expsym_cmds\"
> - else
> - eval cmds=\"$archive_cmds\"
> - fi
>
> # Append the command to remove the reloadable object files
> # to the just-reset $cmds.
> - eval cmds=\"\$cmds~$rm $delfiles\"
> + cmds="$cmds~\$rm \$delfiles"
> fi
> save_ifs="$IFS"; IFS='~'
> for cmd in $cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -3943,10 +3938,10 @@
> reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e
> '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
> ### testsuite: skip nested quoting test
>
> output="$obj"
> - eval cmds=\"$reload_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $reload_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -3979,10 +3974,10 @@
> # Only do commands if we really have different PIC objects.
> reload_objs="$libobjs $reload_conv_objs"
> output="$libobj"
> - eval cmds=\"$reload_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $reload_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -4954,11 +4949,12 @@
>
> # Do each command in the archive commands.
> if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs"
> = yes; then
> - eval cmds=\"$old_archive_from_new_cmds\"
> + cmds=$old_archive_from_new_cmds
> else
> - eval cmds=\"$old_archive_cmds\"
> + cmds=$old_archive_cmds
>
> - if len=`expr "X$cmds" : ".*"` &&
> + eval test_cmds=\"$cmds\"
> + if len=`expr "X$test_cmds" : ".*"` &&
> test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1;
> then
> :
> else
> @@ -4967,7 +4963,6 @@
> save_RANLIB=$RANLIB
> RANLIB=:
> objlist=
> - concat_cmds=
> save_oldobjs=$oldobjs
> # GNU ar 2.10+ was changed to match POSIX; thus no paths are
> # encoded into archives. This makes 'ar r' malfunction in
> @@ -5002,23 +4997,29 @@
> if test "$obj" = "$last_oldobj" ; then
> RANLIB=$save_RANLIB
> fi
> - test -z "$concat_cmds" || concat_cmds=$concat_cmds~
> - eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
> + # a piece archive
> + save_ifs="$IFS"; IFS='~'
> + for cmd in $old_archive_cmds; do
> + IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> + $show "$cmd"
> + $run eval "$cmd" || exit $?
> + done
> + IFS="$save_ifs"
> objlist=
> fi
> done
> RANLIB=$save_RANLIB
> oldobjs=$objlist
> if test "X$oldobjs" = "X" ; then
> - eval cmds=\"\$concat_cmds\"
> - else
> - eval cmds=\"\$concat_cmds~$old_archive_cmds\"
> + cmds=""
> fi
> fi
> fi
> save_ifs="$IFS"; IFS='~'
> for cmd in $cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -5414,10 +5415,10 @@
>
> # Do each command in the postinstall commands.
> lib="$destdir/$realname"
> - eval cmds=\"$postinstall_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $postinstall_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -5636,10 +5637,10 @@
> fi
>
> # Do each command in the postinstall commands.
> - eval cmds=\"$old_postinstall_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $old_postinstall_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || exit $?
> done
> @@ -5674,10 +5675,10 @@
> for libdir in $libdirs; do
> if test -n "$finish_cmds"; then
> # Do each command in the finish commands.
> - eval cmds=\"$finish_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $finish_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd" || admincmds="$admincmds
> $cmd"
> @@ -5951,10 +5952,10 @@
> if test "$mode" = uninstall; then
> if test -n "$library_names"; then
> # Do each command in the postuninstall commands.
> - eval cmds=\"$postuninstall_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $postuninstall_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd"
> if test "$?" -ne 0 && test "$rmforce" != yes; then
> @@ -5966,10 +5967,10 @@
>
> if test -n "$old_library"; then
> # Do each command in the old_postuninstall commands.
> - eval cmds=\"$old_postuninstall_cmds\"
> save_ifs="$IFS"; IFS='~'
> - for cmd in $cmds; do
> + for cmd in $old_postuninstall_cmds; do
> IFS="$save_ifs"
> + eval cmd=\"$cmd\"
> $show "$cmd"
> $run eval "$cmd"
> if test "$?" -ne 0 && test "$rmforce" != yes; then
> -------------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
> Name: ltmain.in-tilde-ifs.patch.gz
> ltmain.in-tilde-ifs.patch.gz Type: unspecified type
> (application/octet-stream)
> Encoding: base64
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------
> _______________________________________________
> Libtool-patches mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/libtool-patches
RE: win32 short name and IFS='~', Boehne, Robert, 2003/04/17