David Miller | 17 Aug 2011 02:45
Favicon

[PATCH 1/2] [SHELL] Allow building without LINEO support.


Simply specify --disable-lineno to configure.

Signed-off-by: David S. Miller <davem <at> davemloft.net>
---
 configure.ac |    5 +++++
 src/var.c    |    4 ++++
 src/var.h    |    6 ++++++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7eae954..96b6310 100644
--- a/configure.ac
+++ b/configure.ac
 <at>  <at>  -131,5 +131,10  <at>  <at>  if test "$use_libedit" != "yes"; then
 else
 	export LIBS="$LIBS -ledit"
 fi
+AC_ARG_ENABLE(lineno, AS_HELP_STRING(--disable-lineno, \
+				     [Disable LINENO support]))
+if test "$enable_lineno" != "no"; then
+	AC_DEFINE([WITH_LINENO], 1, [Define if you build with -DWITH_LINENO])
+fi
 AC_CONFIG_FILES([Makefile src/Makefile])
 AC_OUTPUT
diff --git a/src/var.c b/src/var.c
index ecc8c90..027beff 100644
--- a/src/var.c
+++ b/src/var.c
 <at>  <at>  -101,7 +101,9  <at>  <at>  struct var varinit[] = {
(Continue reading)

Jonathan Nieder | 17 Aug 2011 03:12
Picon

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

David Miller wrote:

> [Subject: [SHELL] Allow building without LINEO support.]

Thanks!  Debian has been using something like this (but unconditional)
to convince autoconf not to use dash as CONFIG_SHELL, to work around
bugs in various configure scripts[1].  I imagine other users might
want the same thing, so a patch like this seems like a good idea.

I think LINEO should be LINENO in the subject line.

[1] http://bugs.debian.org/582952

[...]
> --- a/configure.ac
> +++ b/configure.ac
>  <at>  <at>  -131,5 +131,10  <at>  <at>  if test "$use_libedit" != "yes"; then
>  else
>  	export LIBS="$LIBS -ledit"
>  fi
> +AC_ARG_ENABLE(lineno, AS_HELP_STRING(--disable-lineno, \
> +				     [Disable LINENO support]))
> +if test "$enable_lineno" != "no"; then
> +	AC_DEFINE([WITH_LINENO], 1, [Define if you build with -DWITH_LINENO])
> +fi

This produces the following in config.h:

	/* Define if you build with -DWITH_LINENO */
	#define WITH_LINENO 1
(Continue reading)

Herbert Xu | 17 Aug 2011 03:38
Picon
Picon

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

On Tue, Aug 16, 2011 at 08:12:54PM -0500, Jonathan Nieder wrote:
> David Miller wrote:
> 
> > [Subject: [SHELL] Allow building without LINEO support.]
> 
> Thanks!  Debian has been using something like this (but unconditional)
> to convince autoconf not to use dash as CONFIG_SHELL, to work around
> bugs in various configure scripts[1].  I imagine other users might
> want the same thing, so a patch like this seems like a good idea.
> 
> I think LINEO should be LINENO in the subject line.
> 
> [1] http://bugs.debian.org/582952

So this isn't the reason why Debian has been stuck on 0.5.5.1?
If so what is the reason please?

> Makes sense.  The following on top trims away some code in the
> !WITH_LINENO case, though it's kind of ugly.  Maybe something like
> 
> 	#ifndef WITH_LINENO
> 	static void update_lineno(void) { }
> 	#else
> 	static void update_lineno(void)
> 	{
> 		lineno = errlinno;
> 		if (funcline)
> 			lineno -= funcline - 1;
> 	}
> 	#endif
(Continue reading)

Jonathan Nieder | 17 Aug 2011 04:07
Picon

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

Herbert Xu wrote:

> So this isn't the reason why Debian has been stuck on 0.5.5.1?
> If so what is the reason please?

Probably just Gerrit being busy and me getting distracted by how
to handle the /bin/sh symlink.

I'll propose a package for sid that just moves to the latest upstream
version with no packaging changes later today.

>> Makes sense.  The following on top trims away some code in the
>> !WITH_LINENO case, though it's kind of ugly.  Maybe something like
>>
>> 	#ifndef WITH_LINENO
>> 	static void update_lineno(void) { }
>> 	#else
>> 	static void update_lineno(void)
[...]
>> would make it more palatable.
>
> Yes please do it like that.

Will do this as well.

Thanks,
Jonathan
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo <at> vger.kernel.org
(Continue reading)

Jonathan Nieder | 17 Aug 2011 21:49
Picon

Bug#638223: dash: new upstream version 0.5.7

Package: dash
Version: 0.5.5.1-7.4
Severity: wishlist
Tags: patch

Hi Gerrit,

Herbert Xu wrote:

> So this isn't the reason why Debian has been stuck on 0.5.5.1?
> If so what is the reason please?

My fault, I fear.  I'd like to propose dash 0.5.7 for upload to sid
and experimental.  You can find packaging at

 git://repo.or.cz/dash/debian/jrn.git proposed-uploads
 git://repo.or.cz/dash/debian/jrn.git proposed-experimental

(sid at 3a62c122, experimental at 1ad34abe), or

 dget http://alioth.debian.org/~jrnieder-guest/dash/dash_0.5.7-1.dsc
 dget http://alioth.debian.org/~jrnieder-guest/dash/dash_0.5.7-2~exp1.dsc

The changes are intentionally conservative.  In the package for sid,
there are no packaging changes relative to squeeze except to update
the watch file.  Upstream, there have been many changes, and all
Debian patches except two have been applied upstream.

In the package for experimental, the preinst takes care to make sure
/bin/sh is not overwritten during extraction, to make it easier for
(Continue reading)

Jonathan Nieder | 17 Aug 2011 22:04
Picon

Bug#638223: dash: new upstream version 0.5.7

Jonathan Nieder wrote:

> Example benefit that can be experienced today:
>
> 	dpkg-reconfigure dash; # set "dash as /bin/sh" to false
> 	ln -sf my-custom-shell /bin/sh
> 	dpkg -i dash.deb
>
> will the leave /bin/sh symlink alone.

Now, that example was just silly.  The package already supported
that.

The real benefits of the change will only come once the postinst logic
is changed.  The reason I propose it for upload to experimental is to
check for bugs (though I have been using these changes for a while
without trouble).

Sorry for the lack of clarity.
Jonathan

Jonathan Nieder | 17 Aug 2011 23:01
Picon

Bug#638223: dash: new upstream version 0.5.7

Jonathan Nieder wrote:

> The real benefits of the change will only come once the postinst logic
> is changed.

Here's a quick example.  It adds a choice "custom" to the debconf
prompt that asks where /bin/sh should points.  Admins choosing that
can point /bin/sh where they please with commands like

	ln -sf mksh /bin/sh

As a nice side-effect, if this package is installed from lenny (the
scenario of bugs #538822, #540512) then diversions by other packages
would be left alone and respected, though there would still be a
file conflict with bash until the latter removes its copy of /bin/sh.

But it requires bash or dash to remove its copy of /bin/sh to be
completely robust.

Moreover, I don't think this particular change is actually a good
idea, because of the following sequence of commands:

	dpkg-reconfigure dash; # choose "custom"
	ln -sf mksh /bin/sh
	dpkg --remove mksh

A better system would have to include some logic in or dependencies
on packages that provide a system shell candidate to prevent removal
when they are being used as /bin/sh.  So hopefully this demo
illustrates how far the change to preinst would unravel the diversion
(Continue reading)

Harald van Dijk | 17 Aug 2011 08:04
Picon

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

On Tue, 2011-08-16 at 20:12 -0500, Jonathan Nieder wrote:
> David Miller wrote:
> 
> > [Subject: [SHELL] Allow building without LINEO support.]
> 
> Thanks!  Debian has been using something like this (but unconditional)
> to convince autoconf not to use dash as CONFIG_SHELL, to work around
> bugs in various configure scripts[1].  I imagine other users might
> want the same thing, so a patch like this seems like a good idea.

If you don't mind me asking, if you want configure scripts to run from
bash, why not simply run configure scripts from bash, instead of running
them from sh and trusting that sh will call bash if it is really some
other shell? Don't get me wrong, there are other reasons why making
LINENO support optional is a good idea (smaller executable at the low
cost of a rarely used feature), so don't take this as an argument
against this patch, I'm just curious about this one point.

--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Eric Blake | 17 Aug 2011 14:35
Picon
Favicon
Gravatar

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

On 08/17/2011 12:04 AM, Harald van Dijk wrote:
> On Tue, 2011-08-16 at 20:12 -0500, Jonathan Nieder wrote:
>> David Miller wrote:
>>
>>> [Subject: [SHELL] Allow building without LINEO support.]
>>
>> Thanks!  Debian has been using something like this (but unconditional)
>> to convince autoconf not to use dash as CONFIG_SHELL, to work around
>> bugs in various configure scripts[1].  I imagine other users might
>> want the same thing, so a patch like this seems like a good idea.
>
> If you don't mind me asking, if you want configure scripts to run from
> bash, why not simply run configure scripts from bash, instead of running
> them from sh and trusting that sh will call bash if it is really some
> other shell?

And remember, most configure scripts already support that:

CONFIG_SHELL=path/to/bash path/to/bash ./configure

--

-- 
Eric Blake   eblake <at> redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Herbert Xu | 17 Aug 2011 03:36
Picon
Picon

Re: [PATCH 1/2] [SHELL] Allow building without LINEO support.

On Tue, Aug 16, 2011 at 05:45:02PM -0700, David Miller wrote:
> 
> Simply specify --disable-lineno to configure.
> 
> Signed-off-by: David S. Miller <davem <at> davemloft.net>

Both patches applied.  Thanks a lot!
--

-- 
Email: Herbert Xu <herbert <at> gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
To unsubscribe from this list: send the line "unsubscribe dash" in
the body of a message to majordomo <at> vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Gmane