public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* Re: PATCH to top level: don't use dirname in configure
@ 2000-07-22  8:44 Michael Sokolov
  2000-07-23  4:01 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Sokolov @ 2000-07-22  8:44 UTC (permalink / raw)
  To: binutils, gcc-patches, gdb-patches

Eli Zaretskii <eliz@delorie.com> wrote:

> This assumes that (a) $(progname) always expands to "configure", and
> (b) that the last delimiter is '/'.  I don't know whether the first
> assumption is true on each supported system, but the second might be
> wrong on DOS/Windows where a backslash might be used instead.

Both of these assumptions are already being made extensively by the rest of the
very same Cygnus configure script. The use of dirname there was actually out of
line with respect to the rest of the script, and my patch makes it the same as
the rest of the script.

> In contrast, `dirname' (when it exists) will always DTRT, because it
                          ^^^^^^^^^^^^^^
> is tailored to the host system.

That's where the problem lies. As Alexandre Oliva <aoliva@redhat.com> wrote,

: Unfortunately, `dirname' is too far from being portable.  We must not
: depend on its existence.

GCC, Binutils, and GDB must be usable as add-ons to existing UNIX systems. At
least one of these systems, 4.3BSD, doesn't have dirname. Therefore, the
current top-level configure behaviour is unacceptable for GCC, Binutils, and
GDB.

My patch fixes an existing problem that must be fixed, and it cannot introduce
new problems that didn't exist before (as it does the same thing the rest of
the script does), therefore, it should be checked in.

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-22  8:44 PATCH to top level: don't use dirname in configure Michael Sokolov
@ 2000-07-23  4:01 ` Eli Zaretskii
  0 siblings, 0 replies; 9+ messages in thread
From: Eli Zaretskii @ 2000-07-23  4:01 UTC (permalink / raw)
  To: msokolov; +Cc: binutils, gcc-patches, gdb-patches

> Date: Sat, 22 Jul 00 10:42:11 CDT
> From: msokolov@ivan.Harhan.ORG (Michael Sokolov)
> 
> Eli Zaretskii <eliz@delorie.com> wrote:
> 
> > This assumes that (a) $(progname) always expands to "configure", and
> > (b) that the last delimiter is '/'.  I don't know whether the first
> > assumption is true on each supported system, but the second might be
> > wrong on DOS/Windows where a backslash might be used instead.
> 
> Both of these assumptions are already being made extensively by the
> rest of the very same Cygnus configure script.

Perhaps all of those places should be fixed not to use a literal
"configure".

> My patch fixes an existing problem that must be fixed, and it cannot
> introduce new problems that didn't exist before (as it does the same
> thing the rest of the script does), therefore, it should be checked
> in.

I didn't say the patch shouldn't be checked in (it's something for the
maintainers to decide), I just pointed out a possible regression that
could happen, in case it would be missed.  This is what these forums
are for.  If there's no regression, or if the regression is deemed not
important, it's fine with me.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-23  9:11   ` Jeffrey A Law
@ 2000-07-23 19:32     ` Alexandre Oliva
  0 siblings, 0 replies; 9+ messages in thread
From: Alexandre Oliva @ 2000-07-23 19:32 UTC (permalink / raw)
  To: law; +Cc: Eli Zaretskii, Michael Sokolov, binutils, gcc-patches, gdb-patches

On Jul 23, 2000, Jeffrey A Law <law@cygnus.com> wrote:

> ## this sed command emulates the dirname command
> dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

Autoconf CVS has recently gained a portable implementation of dirname:

# _AC_SHELL_DIRNAME(PATHNAME)
# ---------------------------
# Simulate running `dirname(1)' on PATHNAME, not all systems have it.
# This macro must be usable from inside ` `.
#
# Paul Eggert answers:
# Question: Under UN*X, should `//1' give `/'?
#
# No, under some older flavors of Unix, leading // is a special path
# name: it refers to a "super-root" and is used to access other
# machines' files.  Leading ///, ////, etc. are equivalent to /; but
# leading // is special.  I think this tradition started with Apollo
# Domain/OS, an OS that is still in use on some older hosts.
#
# POSIX.2 allows but does not require the special treatment for //.
# It says that the behavior of dirname on path names of the form
# //([^/]+/*)? is implementation defined.  In these cases, GNU dirname
# returns /, but it's more portable to return // as this works even on
# those older flavors of Unix.
#
# I have heard rumors that this special treatment of // may be dropped
# in future versions of POSIX, but for now it's still the standard.
define([_AC_SHELL_DIRNAME],
[expr X$1 : 'X\(.*[[^/]]\)//*[[^/][^/]]*/*$' \| \
      X$1 : 'X\(//\)[[^/]]' \| \
      X$1 : 'X\(//\)$' \| \
      X$1 : 'X\(/\)' \| \
      .   : '\(.\)'])

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-23  9:44 Michael Sokolov
@ 2000-07-23 10:43 ` Jeffrey A Law
  0 siblings, 0 replies; 9+ messages in thread
From: Jeffrey A Law @ 2000-07-23 10:43 UTC (permalink / raw)
  To: Michael Sokolov; +Cc: binutils, gcc-patches, gdb-patches

  In message < 0007231642.AA21279@ivan.Harhan.ORG >you write:
  > Jeffrey A Law <law@cygnus.com> wrote:
  > 
  > > ## this sed command emulates the dirname command
  > > dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
  > >
  > > [...]
  > >
  > > Michael -- can you verify the sed command I provided above does the right
  > > thing for you?
  > 
  > Yes, it does.
  > 
  > So would you like a patch like the one below?
  > 
  > --
  > Michael Sokolov		Harhan Engineering Laboratory
  > Public Service Agent	International Free Computing Task Force
  > 			International Engineering and Science Task Force
  > 			615 N GOOD LATIMER EXPY STE #4
  > 			DALLAS TX 75204-5852 USA
  > 
  > Phone: +1-214-824-7693 (Harhan Eng Lab office)
  > E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)
  > 
  > 2000-07-23  Michael Sokolov  <msokolov@ivan.Harhan.ORG>
  > 
  > 	* configure (topsrcdir): Don't use dirname.
Thanks.  Installed.
jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
@ 2000-07-23  9:44 Michael Sokolov
  2000-07-23 10:43 ` Jeffrey A Law
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Sokolov @ 2000-07-23  9:44 UTC (permalink / raw)
  To: binutils, gcc-patches, gdb-patches

Jeffrey A Law <law@cygnus.com> wrote:

> ## this sed command emulates the dirname command
> dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
>
> [...]
>
> Michael -- can you verify the sed command I provided above does the right
> thing for you?

Yes, it does.

So would you like a patch like the one below?

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

2000-07-23  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	* configure (topsrcdir): Don't use dirname.

Index: configure
===================================================================
RCS file: /cvs/src/src/configure,v
retrieving revision 1.10
diff -c -r1.10 configure
*** configure	2000/07/22 08:20:10	1.10
--- configure	2000/07/23 16:37:44
***************
*** 518,524 ****
  
  configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
! topsrcdir=`cd \`dirname ${progname}\`; pwd`
  
  
  # this is a hack.  sun4 must always be a valid host alias or this will fail.
--- 518,525 ----
  
  configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
! ## the sed command below emulates the dirname command
! topsrcdir=`cd \`echo ${progname} | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'\`; pwd`
  
  
  # this is a hack.  sun4 must always be a valid host alias or this will fail.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-22  2:20 ` Eli Zaretskii
  2000-07-22  2:33   ` Alexandre Oliva
@ 2000-07-23  9:11   ` Jeffrey A Law
  2000-07-23 19:32     ` Alexandre Oliva
  1 sibling, 1 reply; 9+ messages in thread
From: Jeffrey A Law @ 2000-07-23  9:11 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Sokolov, binutils, gcc-patches, gdb-patches

  In message < 200007220919.FAA12005@indy.delorie.com >you write:
  > > Date: Fri, 21 Jul 00 17:29:14 CDT
  > > From: msokolov@ivan.Harhan.ORG (Michael Sokolov)
  > > 
  > > ! topsrcdir=`cd \`echo ${progname} | sed 's:/configure$::'\`; pwd`
  > 
  > This assumes that (a) $(progname) always expands to "configure", and
  > (b) that the last delimiter is '/'.  I don't know whether the first
  > assumption is true on each supported system, but the second might be
  > wrong on DOS/Windows where a backslash might be used instead.
I believe we can use something like this to deal with the first problem:

## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`

The second problem exists in many places in the various configure & install
scripts and probably should be attacked and fixed en-masse.

Michael -- can you verify the sed command I provided above does the right
thing for you?

Also I'd like to have a comment which references dirname (like the one above)
to make these things easier to find (either when updating them to handle
DOS filesystems in the future, or when we need to find a suitable sed command
to emulate dirname elsewhere).

Thanks,
jeff

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-22  2:20 ` Eli Zaretskii
@ 2000-07-22  2:33   ` Alexandre Oliva
  2000-07-23  9:11   ` Jeffrey A Law
  1 sibling, 0 replies; 9+ messages in thread
From: Alexandre Oliva @ 2000-07-22  2:33 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Michael Sokolov, binutils, gcc-patches, gdb-patches

On Jul 22, 2000, Eli Zaretskii <eliz@delorie.com> wrote:

> In contrast, `dirname' (when it exists) will always DTRT, because it
> is tailored to the host system.

Unfortunately, `dirname' is too far from being portable.  We must not
depend on its existence.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: PATCH to top level: don't use dirname in configure
  2000-07-21 15:31 Michael Sokolov
@ 2000-07-22  2:20 ` Eli Zaretskii
  2000-07-22  2:33   ` Alexandre Oliva
  2000-07-23  9:11   ` Jeffrey A Law
  0 siblings, 2 replies; 9+ messages in thread
From: Eli Zaretskii @ 2000-07-22  2:20 UTC (permalink / raw)
  To: Michael Sokolov; +Cc: binutils, gcc-patches, gdb-patches

> Date: Fri, 21 Jul 00 17:29:14 CDT
> From: msokolov@ivan.Harhan.ORG (Michael Sokolov)
> 
> ! topsrcdir=`cd \`echo ${progname} | sed 's:/configure$::'\`; pwd`

This assumes that (a) $(progname) always expands to "configure", and
(b) that the last delimiter is '/'.  I don't know whether the first
assumption is true on each supported system, but the second might be
wrong on DOS/Windows where a backslash might be used instead.

In contrast, `dirname' (when it exists) will always DTRT, because it
is tailored to the host system.

^ permalink raw reply	[flat|nested] 9+ messages in thread

* PATCH to top level: don't use dirname in configure
@ 2000-07-21 15:31 Michael Sokolov
  2000-07-22  2:20 ` Eli Zaretskii
  0 siblings, 1 reply; 9+ messages in thread
From: Michael Sokolov @ 2000-07-21 15:31 UTC (permalink / raw)
  To: binutils, gcc-patches, gdb-patches

Hi there,

Below is a patch to the top level of the tree (both src and gcc repos) for the
Cygnus configure script used there. It uses dirname, which 4.3BSD doesn't have.
This patch changes it to the obvious equivalent that doesn't use dirname. (This
is a patch to configure, not configure.in etc., because this is the Cygnus
configure script and the bug is in the static part that's the same whereever
the script is used.)

--
Michael Sokolov		Harhan Engineering Laboratory
Public Service Agent	International Free Computing Task Force
			International Engineering and Science Task Force
			615 N GOOD LATIMER EXPY STE #4
			DALLAS TX 75204-5852 USA

Phone: +1-214-824-7693 (Harhan Eng Lab office)
E-mail: msokolov@ivan.Harhan.ORG (ARPA TCP/SMTP) (UUCP coming soon)

2000-07-21  Michael Sokolov  <msokolov@ivan.Harhan.ORG>

	* configure (topsrcdir): Don't use dirname.

Index: configure
===================================================================
RCS file: /cvs/src/src/configure,v
retrieving revision 1.9
diff -c -3 -p -r1.9 configure
*** configure	2000/05/21 16:57:14	1.9
--- configure	2000/07/21 22:21:22
*************** fi
*** 518,524 ****
  
  configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
! topsrcdir=`cd \`dirname ${progname}\`; pwd`
  
  
  # this is a hack.  sun4 must always be a valid host alias or this will fail.
--- 518,524 ----
  
  configsub=`echo ${progname} | sed 's/configure$/config.sub/'`
  moveifchange=`echo ${progname} | sed 's/configure$/move-if-change/'`
! topsrcdir=`cd \`echo ${progname} | sed 's:/configure$::'\`; pwd`
  
  
  # this is a hack.  sun4 must always be a valid host alias or this will fail.

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2000-07-23 19:32 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-07-22  8:44 PATCH to top level: don't use dirname in configure Michael Sokolov
2000-07-23  4:01 ` Eli Zaretskii
  -- strict thread matches above, loose matches on Subject: below --
2000-07-23  9:44 Michael Sokolov
2000-07-23 10:43 ` Jeffrey A Law
2000-07-21 15:31 Michael Sokolov
2000-07-22  2:20 ` Eli Zaretskii
2000-07-22  2:33   ` Alexandre Oliva
2000-07-23  9:11   ` Jeffrey A Law
2000-07-23 19:32     ` Alexandre Oliva

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).