Bug#985478: [v2 PATCH] options: Always reset OPTIND in getoptsreset

2024-05-19 Thread Herbert Xu
On Sun, May 19, 2024 at 02:23:23PM +0100, Harald van Dijk wrote:
>
> This interacts terribly with the not fully reliable but nevertheless fairly
> commonly used "local OPTIND". When the local OPTIND goes out of scope and
> the prior value of OPTIND is restored, the expectation is not that option
> processing restarts from the beginning.

Dash doesn't actually need "local OPTIND".  In fact, if you do
"local OPTIND" then dash will already be broken because even
if OPTIND is reset to the same value, the other internal state
optoff will end up being wrong.

However, it's not hard to make dash ignore "local OPTIND" and
make it work as if it wasn't there.

---8<---
Always reset OPTIND if it is modified by the user, regardless of
its value.

Do not call getoptsreset when returning from a function because
of "local OPTIND" as this simply trashes the caller's getopts
state.

Reported-by: наб 
Reported-by: Harald van Dijk 
Signed-off-by: Herbert Xu 

diff --git a/src/options.c b/src/options.c
index 4d0a53a..c74e4fe 100644
--- a/src/options.c
+++ b/src/options.c
@@ -393,7 +393,7 @@ setcmd(int argc, char **argv)
 
 void getoptsreset(const char *value)
 {
-   shellparam.optind = number(value) ?: 1;
+   shellparam.optind = 1;
shellparam.optoff = -1;
 }
 
diff --git a/src/var.c b/src/var.c
index df432b5..b06b36c 100644
--- a/src/var.c
+++ b/src/var.c
@@ -93,7 +93,7 @@ struct var varinit[] = {
{ 0,VSTRFIXED|VTEXTFIXED,   "PS1=$ ",   0 },
{ 0,VSTRFIXED|VTEXTFIXED,   "PS2=> ",   0 },
{ 0,VSTRFIXED|VTEXTFIXED,   "PS4=+ ",   0 },
-   { 0,VSTRFIXED|VTEXTFIXED,   defoptindvar,   getoptsreset },
+   { 0,VSTRFIXED|VTEXTFIXED|VNOFUNC,   defoptindvar,   getoptsreset },
 #ifdef WITH_LINENO
{ 0,VSTRFIXED|VTEXTFIXED,   linenovar,  0 },
 #endif
@@ -535,7 +535,7 @@ poplocalvars(void)
ckfree(vp->text);
vp->flags = lvp->flags;
vp->text = lvp->text;
-   if (vp->func)
+   if (vp->func && !(vp->flags & VNOFUNC))
(*vp->func)(varnull(vp->text));
}
ckfree(lvp);
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#985478: [PATCH] options: Always reset OPTIND in getoptsreset

2024-05-19 Thread Herbert Xu
On Wed, Jan 04, 2023 at 04:50:34PM +, Harald van Dijk wrote:
>
> Personally, I do think it is better if shells allow assigning arbitrary
> values to OPTIND, including unsetting it, and only have the getopts command
> raise an error if the value is non-numeric, but that is my personal opinion
> and I don't see much of a problem if dash decides to go the other way,
> unless POSIX makes it explicit that it is not permitted for shells to do
> this. FWIW, I did make that change for my version, 
> <https://github.com/hvdijk/gwsh/commit/0df0ba33748eb3881b07cb724fd4fa54422ef2bc>,
> if that change is desired for dash it is easy to apply.

I've decided to make getoptsreset always do the reset, regardless
of the value of OPTIND.  Why else would you assign it anyway?

---8<---
Always reset OPTIND if it is modified by the user, regardless of
its value.

Reported-by: наб 
Signed-off-by: Herbert Xu 

diff --git a/src/options.c b/src/options.c
index 4d0a53a..c74e4fe 100644
--- a/src/options.c
+++ b/src/options.c
@@ -393,7 +393,7 @@ setcmd(int argc, char **argv)
 
 void getoptsreset(const char *value)
 {
-   shellparam.optind = number(value) ?: 1;
+   shellparam.optind = 1;
    shellparam.optoff = -1;
 }
 
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#547902: Upstream fix coming soon

2024-05-19 Thread Herbert Xu
This will be fixed upstream soon with

https://patchwork.kernel.org/project/dash/patch/fd52d05affd400c2c2f2ba238ff83555d11ca648.1716096097.git.herb...@gondor.apana.org.au/

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#935781: manpages: nsswitch.conf should document automount option

2023-12-26 Thread Herbert Xu
On Sat, Dec 23, 2023 at 11:52:01AM +, Helge Kreutzmann wrote:
>
> > http://web.mit.edu/rhel-doc/5/RHEL-5-manual/Deployment_Guide-en-US/s1-nfs-client-config-autofs.html
> 
> The link does not work anymore.

https://web.archive.org/web/20220511033543/https://web.mit.edu/rhel-doc/5/RHEL-5-manual/Deployment_Guide-en-US/s1-nfs-client-config-autofs.html

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#1053550: IKEv2 regression when IP address changes behind NAT-T

2023-10-06 Thread Herbert Xu
Package: libreswan
Version: 4.10-2+deb12u1

When the IP address of a host behind NAT changes, libreswan fails
to respond correctly when IKEv2 is used.  This is a regression from
IKEv1 as libreswan will correctly shut down the existing connection
and initiate a new one when DPD kicks in.

Let the host behind NAT be A, and the server be B.  When A's IP
address changes, its data connection to B will be broken.  However,
B continues to respond to A's liveliness messages thus preventing
A from tearing the broken connection down.  This will only resolve
itself when A's SA eventually times out and is rekeyed.

Here is a packet dump on B's side showing this:

A's old address: XXX.XXX.107.30.15410
A's new address: XXX.XXX.212.186.25610
B: XXX.XXX.189.96.4502

07:17:42.939963 IP XXX.XXX.212.186.25610 > XXX.XXX.189.96.4502: UDP, length 140

Packet is sent from A's new address.  It is correctly processed
by the kernel (Linux ignores the source address on inbound packets).

07:17:42.940182 IP XXX.XXX.189.96.4502 > XXX.XXX.107.30.15410: UDP-encap: 
ESP(spi=0xd4b2be8b,seq=0x1), length 140

Packet is sent back to A's old address, because libreswan has
not updated the outbound SA to use the new address.  This is
suboptimal but not a regression as libreswan never had code to
deal with this case.  With IKEv1, DPD would eventually kick in
and reestablish the connection.  However, with IKEv2 we instead
see this:

07:18:02.690370 IP XXX.XXX.212.186.25610 > XXX.XXX.189.96.4502: UDP, length 1
07:18:22.687887 IP XXX.XXX.212.186.25610 > XXX.XXX.189.96.4502: UDP, length 1
07:18:26.793134 IP XXX.XXX.212.186.25610 > XXX.XXX.189.96.4502: UDP, length 61
07:18:26.793398 IP XXX.XXX.189.96.4502 > XXX.XXX.212.186.25610: UDP, length 61
07:18:26.793439 IP XXX.XXX.189.96.4502 > XXX.XXX.212.186.25610: UDP, length 61

As you can see from this, libreswan on B responds to A's new IP
address, making A think that the connection is still alive.  This
does not happen with IKEv1.  B should either not respond to the
packet from the new address, or it should tear down the old SAs
and create new ones with the new address.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#874264: [PATCH] exec: Check executable bit when searching path

2021-11-09 Thread Herbert Xu
Andrej Shadura  wrote:
> 
> Here’s an old bug from 2017, but it was brought to my attention in some 
> recent discussion about which "which" is which. There’s also a patch in 
> one of the follow-ups, but I’m afraid I don’t know enough about that 
> part of code to judge the consequences of it being applied:
> 
> https://bugs.debian.org/874264
> 
>  Forwarded Message 
> Subject: dash: 'command -v' mistakenly returns a shell script whose 
> executable is not set
> Date: Mon, 04 Sep 2017 10:45:48 -0400
> From: Norman Ramsey 
> To: Debian Bug Tracking System 
> 
> Package: dash
> Version: 0.5.8-2.4
> Severity: normal
> 
> Dear Maintainer,
> 
> 
> I tracked a build bug in s-nail to a problem with dash.  Symptom:
> building s-nail tries to run /home/nr/bin/clang, a script whose
> executable bit is not set.  We tracked the problem to the result of
> running `command -v clang` with /bin/sh:
> 
>   nr@homedog ~/n/s-nail> /bin/sh -c 'command -v clang'
>   /home/nr/bin/clang
>   nr@homedog ~/n/s-nail> ls -l /home/nr/bin/clang
>   -rw-rw-r-- 1 nr nr 1009 Aug 29  2011 /home/nr/bin/clang
>   nr@homedog ~/n/s-nail> ls -l /bin/sh
>   lrwxrwxrwx 1 root root 4 Jan 24  2017 /bin/sh -> dash
>   nr@homedog ~/n/s-nail> ksh -c 'command -v clang'
>   /usr/bin/clang
>   nr@homedog ~/n/s-nail> bash -c 'command -v clang'
>   /usr/bin/clang
>   nr@homedog ~/n/s-nail> sh -c 'command -v clang'
>   /home/nr/bin/clang
>   nr@homedog ~/n/s-nail> dash -c 'command -v clang'
>   /home/nr/bin/clang
>   nr@homedog ~/n/s-nail> fish -c 'command -v clang'
>   /usr/bin/clang
> 
> When I run `command -v clang` I expect it to answer /usr/bin/clang.
> 
> -- System Information:
> Debian Release: 9.1
>   APT prefers stable
>   APT policy: (990, 'stable'), (500, 'stable'), (1, 'experimental')
> Architecture: i386 (x86_64)
> Foreign Architectures: amd64
> 
> Kernel: Linux 4.9.0-3-amd64 (SMP w/4 CPU cores)
> Locale: LANG=C, LC_CTYPE=C (charmap=UTF-8) (ignored: LC_ALL set to 
> en_US.utf8), LANGUAGE=C (charmap=UTF-8) (ignored: LC_ALL set to en_US.utf8)
> Shell: /bin/sh linked to /bin/dash
> Init: systemd (via /run/systemd/system)
> 
> Versions of packages dash depends on:
> ii  debianutils  4.8.1.1
> ii  dpkg 1.18.24
> ii  libc62.24-11+deb9u1
> 
> dash recommends no packages.
> 
> dash suggests no packages.
> 
> -- debconf information:
> * dash/sh: true

This is inherited from NetBSD.  There is even a commented-out
block of code that tried to fix this.

Anyway, we now have faccessat so we can simply use it.

Reported-by: Norman Ramsey 
Signed-off-by: Herbert Xu 

diff --git a/src/bltin/test.c b/src/bltin/test.c
index c7fc479..fd8a43b 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -18,6 +18,7 @@
 #include 
 #include 
 #include "bltin.h"
+#include "../exec.h"
 
 /* test(1) accepts the following grammar:
oexpr   ::= aexpr | aexpr "-o" oexpr ;
@@ -148,11 +149,6 @@ static int isoperand(char **);
 static int newerf(const char *, const char *);
 static int olderf(const char *, const char *);
 static int equalf(const char *, const char *);
-#ifdef HAVE_FACCESSAT
-static int test_file_access(const char *, int);
-#else
-static int test_access(const struct stat64 *, int);
-#endif
 
 #ifdef HAVE_FACCESSAT
 # ifdef HAVE_TRADITIONAL_FACCESSAT
@@ -527,7 +523,7 @@ static int has_exec_bit_set(const char *path)
return st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH);
 }
 
-static int test_file_access(const char *path, int mode)
+int test_file_access(const char *path, int mode)
 {
if (faccessat_confused_about_superuser() &&
mode == X_OK && geteuid() == 0 && !has_exec_bit_set(path))
@@ -657,7 +653,7 @@ static int test_file_access(const char *path, int mode)
  * (euid==uid&&egid==gid), but uses st_mode for '-x' iff running as root.
  * i.e. it does strictly conform to 1003.1-2001 (and presumably 1003.2b).
  */
-static int test_access(const struct stat64 *sp, int stmode)
+int test_access(const struct stat64 *sp, int stmode)
 {
gid_t *groups;
register int n;
diff --git a/src/exec.c b/src/exec.c
index 87354d4..184717f 100644
--- a/src/exec.c
+++ b/src/exec.c
@@ -458,20 +458,14 @@ loop:
stunalloc(fullname);
goto success;
}
-#ifdef notdef
-   /* XXX this code stops root executing stuff, and is buggy
-  if you need a group from the group list. */
-   if (statb.st_uid == geteuid()) {
-   if ((statb.st_mode & 0100) == 0)
-   got

Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Thu, Dec 10, 2020 at 10:20:29AM -0500, Jeff King wrote:
>
> It seems like it happens for "foo/", too. If I compile:

I think the key is that dash uses GLOB_NOMAGIC.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Wed, Dec 09, 2020 at 01:27:17PM +0100, Aurelien Jarno wrote:
>
> Can you please describe more precisely what is the problem with glob(3)?

Create a regular file called "foo", then call glob(3) with the
pattern "foo\/".  This returns a single match with the string
"foo".  This should return no match.

If you change the pattern to "foo/", then it also matches but
returns with the string "foo/" as expected.

The only flag we pass to glob(3) is GLOB_NOMAGIC.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-10 Thread Herbert Xu
On Thu, Dec 10, 2020 at 08:58:37AM +0100, Aurelien Jarno wrote:
>
> That's the dash symptoms. glob(3) takes a pattern and just returns the
> paths matching the pattern, as they are named on the filesystem. That
> said, the option GLOB_MARK can return a trailing slash for all matched
> path that are a directory.

Yes but it's really a bug in glob(3).  It should really return
a no-match for the case in question, rather than matching and then
returning a filename without the slash.

IOW the pattern "foo\/" should not match a regular file foo.

Note that the problem doesn't occur for "foo/".

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#976865: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-12-09 Thread Herbert Xu
Aurelien Jarno  wrote:
>
> Can you please describe more precisely what is the problem with glob(3)?

It's stripping trailing slashes from the pattern, even when the
name in question is a regular file.

https://patchwork.kernel.org/project/dash/patch/20201116025222.ga28...@gondor.apana.org.au/

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-06 Thread Herbert Xu
On Thu, Dec 03, 2020 at 01:27:51PM +0100, Michael Biebl wrote:
>
> Hm, so I applied this change and switched backed to dash, but now I get
> 
> autopkgtest systemd --test-name=timedated -s -- lxc -s autopkgtest-sid
> ...
> disable NTP
> enable NTP
> Terminated
> autopkgtest [13:21:42]: test timedated: ---]
> autopkgtest [13:21:42]: test timedated:  - - - - - - - - - - results - - - -
> - - - - - -
> timedatedFAIL non-zero exit status 143
> 
> 
> Running with sh -x
> ...
> + kill 825
> + wait 825
> Terminated
> 
> 
> Herbert, any idea what going wrong there?
> (systemd 247.1-2 and dash 0.5.11+git20200708+dd9ef66-2)

Sorry, my bad.  wait(1) with no arguments ignores the error status
of the child and always return zero.  wait(1) specifically on a
child obviously returns the error status of that child.  Since the
child was killed, we need to ignore that, so this works for me:

wait $MONPID 2> /dev/null || :

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: [PATCH] jobs: Only block in waitcmd on first run

2020-12-01 Thread Herbert Xu
This patch ensures that waitcmd never blocks unless there are
outstanding jobs.  This could otherwise trigger a hang if children
were created prior to the shell coming into existence, or if
there are backgrounded children of other kinds (e.g., a here-
document).

Fixes: 6c691b3e5099 ("jobs: Only clear gotsigchld when waiting...")
Reported-by: Michael Biebl 
Signed-off-by: Herbert Xu 

diff --git a/src/jobs.c b/src/jobs.c
index 3417633..516786f 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -81,6 +81,7 @@
 #define DOWAIT_NONBLOCK 0
 #define DOWAIT_BLOCK 1
 #define DOWAIT_WAITCMD 2
+#define DOWAIT_WAITCMD_ALL 4
 
 /* array of jobs */
 static struct job *jobtab;
@@ -615,7 +616,7 @@ waitcmd(int argc, char **argv)
jp->waited = 1;
jp = jp->prev_job;
}
-   if (!dowait(DOWAIT_WAITCMD, 0))
+   if (!dowait(DOWAIT_WAITCMD_ALL, 0))
goto sigout;
}
}
@@ -1138,6 +1139,7 @@ static int dowait(int block, struct job *jp)
pid = waitone(block, jp);
rpid &= !!pid;
 
+   block &= ~DOWAIT_WAITCMD_ALL;
if (!pid || (jp && jp->state != JOBRUNNING))
block = DOWAIT_NONBLOCK;
} while (pid >= 0);
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-01 Thread Herbert Xu
On Wed, Dec 02, 2020 at 12:21:52AM +0100, Michael Biebl wrote:
>
> I'll update the timedated test accordingly.
> Incidentally we already have
> https://salsa.debian.org/systemd-team/systemd/-/merge_requests/110

Thanks.

I will make dash not wait for existing children as this is indeed
a change in behaviour which is undesirable.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-01 Thread Herbert Xu
On Tue, Dec 01, 2020 at 10:59:20AM +, Harald van Dijk wrote:
> 
> I do not appreciate your false accusation that I did not read your follow-up
> email. You suggested that as an alternative, without retracting your claim
> that this is a problem in bash.

Well I'm not accusing you of anything, I was just trying to make
sure you are aware of my complete message.

In any case, I never said that this is a bug in bash, merely that
bash is involved in creating a situation where dash started out
with children in the background.

If anything this could just be an artefact of the bash script
rather than bash itself.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-01 Thread Herbert Xu
On Tue, Dec 01, 2020 at 10:50:19AM +, Harald van Dijk wrote:
> 
> This used to exit immediately, leaving the sleep process running in the
> background without waiting for it. On the dash that's currently provided by
> Ubuntu, based on 0.5.10.2, it still behaves that way. With current dash from
> Git, it does not. This is clearly a change in behaviour in dash not in
> response to any bug (real or not) in bash.

I'm not suggesting it's a bug in bash.  If anything it's a bug
in the script.  You should never do a naked wait unless you are
sure that there are no other children around that you don't know of.

In the original bug, the proper solution is to wait on the PID
that the script just sent a kill signal to.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-01 Thread Herbert Xu
On Tue, Dec 01, 2020 at 10:55:06AM +, Harald van Dijk wrote:
> 
> You wrote: "So the problem is really in the parent of this shell, which
> appears to be bash:"

You should read my follow-up email too that suggested changing
the systemd script.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-12-01 Thread Herbert Xu
On Tue, Dec 01, 2020 at 10:14:04AM +, Harald van Dijk wrote:
> 
> POSIX says:
> 
>   "If  the  wait utility is invoked with no operands, it shall wait until
> all process IDs known to the invoking shell have terminated and exit with a
> zero exit status."
> 
> I would say that child processes that were created before dash was started
> do not have process IDs known to dash.

Well I disagree and the fact that the original ksh does the same
thing is an important fact.

> > bash -c set -e; export USER=`id -nu`; . /etc/profile >/dev/null 2>&1 || 
> > true;  . ~/.profile >/dev/null 2>&1 || true; 
> > buildtree="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree"; 
> > mkdir -p -m 1777 -- 
> > "/tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-artifacts"; export 
> > AUTOPKGTEST_ARTIFACTS="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-artifacts";
> >  export ADT_ARTIFACTS="$AUTOPKGTEST_ARTIFACTS"; mkdir -p -m 755 
> > "/tmp/autopkgtest-lxc.is4n6xxr/downtmp/autopkgtest_tmp"; export 
> > AUTOPKGTEST_TMP="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/autopkgtest_tmp"; 
> > export ADTTMP="$AUTOPKGTEST_TMP"; export DEBIAN_FRONTEND=noninteractive; 
> > export LANG=C.UTF-8; export DEB_BUILD_OPTIONS=parallel=2; unset LANGUAGE 
> > LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE   LC_MONETARY LC_MESSAGES LC_PAPER 
> > LC_NAME LC_ADDRESS   LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION 
> > LC_ALL;rm -f /tmp/autopkgtest_script_pid; set -C; echo $$ > 
> > /tmp/autopkgtest_script_pid; set +C; trap "rm -f 
> > /tmp/autopkgtest_script_pid" EXIT INT QUIT PIPE; cd "$buildtree"; export 
> > AUTOPKGTEST_NORMAL_USER=; export ADT_NORMAL_USER=; chmod +x 
> > /tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree/debian/tests/timedated;
> >  touch /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stdout 
> > /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stderr; 
> > /tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree/debian/tests/timedated
> >  2> >(tee -a /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stderr >&2) > 
> > >(tee -a /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stdout);
> > 
> > For some reason this is causing the final two tee's to be created
> > as children of debian/tests/timedated rather than the bash shell.
> 
> This is because of the same optimisation that dash also has, where it tries
> to avoid creating a subshell for the last command in a list when it can just
> exec() without a fork() instead. A minimal example without an explicit exec
> is
> 
>   bash -c 'dash -c ": & wait" <(sleep 1d)'

I'm not sure about that because bash itself is still hanging around,
if it were really the -c optimisation then bash should not appear in
the ps output at all.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-11-30 Thread Herbert Xu
On Tue, Dec 01, 2020 at 05:06:18PM +1100, Herbert Xu wrote:
>
> For some reason this is causing the final two tee's to be created
> as children of debian/tests/timedated rather than the bash shell.

An alternative to changing the parent is of course to do

wait $MONPID

instead of

wait

I think this makes more sense anyway as otherwise someone could
easily introduce a hang if they unwittingly add a backgrounded
job to this script.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-11-30 Thread Herbert Xu
On Tue, Dec 01, 2020 at 04:38:37PM +1100, Herbert Xu wrote:
> 
> FWIW I'm unable to reproduce it with autopkgtest.  This is what
> I get:
> 
> root@test0:~# autopkgtest --test-name=timedated systemd-246.6/ -B -- lxc -s 
> autopkgtest-sid
> autopkgtest [16:32:45]: starting date: 2020-12-01
> autopkgtest [16:32:45]: version 5.15
> autopkgtest [16:32:45]: host test0; command line: /usr/bin/autopkgtest 
> --test-name=timedated systemd-246.6/ -B -- lxc -s autopkgtest-sid
> autopkgtest [16:33:13]: testbed dpkg architecture: amd64
> autopkgtest [16:33:13]: testbed running kernel: Linux 5.9.0-rc1+ #18 SMP 
> PREEMPT Sat Aug 29 23:45:30 AEST 2020
> autopkgtest [16:33:13]:  unbuilt-tree systemd-246.6/
> autopkgtest [16:33:18]: testing package systemd version 246.6-5

Nevermind, I see that the script has been modified to use bash.

I can reproduce the problem now so it's all good.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-11-30 Thread Herbert Xu
On Mon, Nov 16, 2020 at 10:29:16AM +, Andrej Shadura wrote:
> 
> I’d like to forward a bug report I received. Michael, who reported it,
> was able to bisect it to 6c691b3, which was the first of the series of
> commits changing job handling.
> 
> I must note that I had troubles debugging it: I was only able to
> reproduce the issue in an autopkgtest virtual machine, but not on my
> normal system nor in a fresh Debian unstable Docker container.

FWIW I'm unable to reproduce it with autopkgtest.  This is what
I get:

root@test0:~# autopkgtest --test-name=timedated systemd-246.6/ -B -- lxc -s 
autopkgtest-sid
autopkgtest [16:32:45]: starting date: 2020-12-01
autopkgtest [16:32:45]: version 5.15
autopkgtest [16:32:45]: host test0; command line: /usr/bin/autopkgtest 
--test-name=timedated systemd-246.6/ -B -- lxc -s autopkgtest-sid
autopkgtest [16:33:13]: testbed dpkg architecture: amd64
autopkgtest [16:33:13]: testbed running kernel: Linux 5.9.0-rc1+ #18 SMP 
PREEMPT Sat Aug 29 23:45:30 AEST 2020
autopkgtest [16:33:13]:  unbuilt-tree systemd-246.6/
autopkgtest [16:33:18]: testing package systemd version 246.6-5
autopkgtest [16:33:18]: build not needed
autopkgtest [16:33:18]: test timedated: preparing testbed
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies...Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
 Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following additional packages will be installed:
  acl libnss-systemd
The following NEW packages will be installed:
  acl libnss-systemd
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
Need to get 255 kB of archives.
After this operation, 577 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian sid/main amd64 libnss-systemd amd64 246.6-5 
[194 kB]
Get:2 http://deb.debian.org/debian sid/main amd64 acl amd64 2.2.53-8 [60.8 kB]
Fetched 255 kB in 1s (489 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package libnss-systemd:amd64.
(Reading database ... 12641 files and directories currently installed.)
Preparing to unpack .../libnss-systemd_246.6-5_amd64.deb ...
Unpacking libnss-systemd:amd64 (246.6-5) ...
Selecting previously unselected package acl.
Preparing to unpack .../acl_2.2.53-8_amd64.deb ...
Unpacking acl (2.2.53-8) ...
Setting up libnss-systemd:amd64 (246.6-5) ...
First installation detected...
Checking NSS setup...
Setting up acl (2.2.53-8) ...
Setting up autopkgtest-satdep (0) ...
Processing triggers for libc-bin (2.31-4) ...
(Reading database ... 12667 files and directories currently installed.)
Removing autopkgtest-satdep (0) ...
autopkgtest [16:33:29]: test timedated: [---
original tz: Etc/UTC
timedatectl works
change timezone
reset timezone to original
no adjtime file
UTC set in adjtime file
non-zero values in adjtime file
fourth line adjtime file
no final newline in adjtime file
only one line in adjtime file
only one line in adjtime file, no final newline
only two lines in adjtime file
only two lines in adjtime file, no final newline
unknown value in 3rd line of adjtime file
disable NTP
enable NTP
re-disable NTP
autopkgtest [16:33:32]: test timedated: ---]
autopkgtest [16:33:32]: test timedated:  - - - - - - - - - - results - - - - - 
- - - - -
timedatedPASS
autopkgtest [16:33:32]:  summary
timedatedPASS
root@test0:~# 

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974705: Changes to job handling cause hangs in wait

2020-11-30 Thread Herbert Xu
On Tue, Dec 01, 2020 at 04:42:03PM +1100, Herbert Xu wrote:
>
> Nevermind, I see that the script has been modified to use bash.
> 
> I can reproduce the problem now so it's all good.

OK the problem is this:

sh -c 'sleep 1d& exec $MYSHELL -c "sleep 1& wait"'

You can replace MYSHELL with whatever shell you want to use.

Essentially dash will now wait for all children, even ones that
were created prior to its existence, however, bash only waits for
children that it created directly.

FWIW ksh exhibits the same behaviour as dash and I think there
is nothing wrong with this.

So the problem is really in the parent of this shell, which appears
to be bash:

bash -c set -e; export USER=`id -nu`; . /etc/profile >/dev/null 2>&1 || true;  
. ~/.profile >/dev/null 2>&1 || true; 
buildtree="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree"; mkdir -p 
-m 1777 -- "/tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-artifacts"; export 
AUTOPKGTEST_ARTIFACTS="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-artifacts";
 export ADT_ARTIFACTS="$AUTOPKGTEST_ARTIFACTS"; mkdir -p -m 755 
"/tmp/autopkgtest-lxc.is4n6xxr/downtmp/autopkgtest_tmp"; export 
AUTOPKGTEST_TMP="/tmp/autopkgtest-lxc.is4n6xxr/downtmp/autopkgtest_tmp"; export 
ADTTMP="$AUTOPKGTEST_TMP"; export DEBIAN_FRONTEND=noninteractive; export 
LANG=C.UTF-8; export DEB_BUILD_OPTIONS=parallel=2; unset LANGUAGE LC_CTYPE 
LC_NUMERIC LC_TIME LC_COLLATE   LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME 
LC_ADDRESS   LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL;rm -f 
/tmp/autopkgtest_script_pid; set -C; echo $$ > /tmp/autopkgtest_script_pid; set 
+C; trap "rm -f /tmp/autopkgtest_script_pid" EXIT INT QUIT PIPE; cd 
"$buildtree"; export AUTOPKGTEST_NORMAL_USER=; export ADT_NORMAL_USER=; chmod 
+x 
/tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree/debian/tests/timedated;
 touch /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stdout 
/tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stderr; 
/tmp/autopkgtest-lxc.is4n6xxr/downtmp/build.f2G/real-tree/debian/tests/timedated
 2> >(tee -a /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stderr >&2) > 
>(tee -a /tmp/autopkgtest-lxc.is4n6xxr/downtmp/timedated-stdout);

For some reason this is causing the final two tee's to be created
as children of debian/tests/timedated rather than the bash shell.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#974900: Fwd: Bug#974900: dash removes trailing slash from script arguments

2020-11-16 Thread Herbert Xu
Andrej Shadura  wrote:
> 
> this is another bug report I have received.

This is a bug in glob(3).  Please dup and reassign to libc6.  There
is a patch in the queue to disable glob by default again.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#858288: [PATCH] eval: Check nflag in evaltree instead of cmdloop

2020-06-04 Thread Herbert Xu
This patch moves the nflag check from cmdloop into evaltree.  This
is so that nflag will be in force even if we enter the shell via a
path other than cmdloop, e.g., through sh -c.

Reported-by: Joey Hess 
Signed-off-by: Herbert Xu 

diff --git a/src/eval.c b/src/eval.c
index d10be38..9476fbb 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -213,6 +213,9 @@ evaltree(union node *n, int flags)
 
setstackmark(&smark);
 
+   if (nflag)
+   goto out;
+
if (n == NULL) {
TRACE(("evaltree(NULL) called\n"));
goto out;
diff --git a/src/main.c b/src/main.c
index 7a28534..5c49fdc 100644
--- a/src/main.c
+++ b/src/main.c
@@ -233,7 +233,7 @@ cmdloop(int top)
out2str("\nUse \"exit\" to leave shell.\n");
}
numeof++;
-   } else if (nflag == 0) {
+   } else {
int i;
 
job_warning = (job_warning == 2) ? 1 : 0;
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#782540: dash: wait returns whenever a child process is stopped/continued

2020-06-02 Thread Herbert Xu
This is fixed in dash 0.5.11.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#716789: dash: Dash sometimes misbehaves when backticks are included after an || operator

2020-06-02 Thread Herbert Xu
This has been fixed in dash 0.5.11.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#716789: dash: Dash sometimes misbehaves when backticks are included after an || operator

2020-05-28 Thread Herbert Xu
This has been fixed upstream with


https://git.kernel.org/pub/scm/utils/dash/dash.git/commit/?id=51e2d88d6e513150a76c007111bbee21bb922c33

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#755446: [PATCH] redir: Retry open64 on EINTR

2020-05-28 Thread Herbert Xu
It is possible for open64 to block on named pipes, and therefore
it can be interrupted by signals and return EINTR.  We should only
let it fail with EINTR if real signals are pending (i.e., it should
not fail on SIGCHLD if SIGCHLD has not been trapped).

This patch adds a new helper sh_open to retry the open64 call if
necessary.  It also calls sh_error when appropriate.

Fixes: 3800d4934391 ("[JOBS] Fix dowait signal race")
Reported-by: Samuel Thibault 
Signed-off-by: Herbert Xu 

diff --git a/src/input.c b/src/input.c
index 17544e7..6103312 100644
--- a/src/input.c
+++ b/src/input.c
@@ -393,12 +393,9 @@ setinputfile(const char *fname, int flags)
int fd;
 
INTOFF;
-   if ((fd = open64(fname, O_RDONLY)) < 0) {
-   if (flags & INPUT_NOFILE_OK)
-   goto out;
-   exitstatus = 127;
-   exerror(EXERROR, "Can't open %s", fname);
-   }
+   fd = sh_open(fname, O_RDONLY, flags & INPUT_NOFILE_OK);
+   if (fd < 0)
+   goto out;
if (fd < 10)
fd = savefd(fd, fd);
setinputfd(fd, flags & INPUT_PUSH_FILE);
diff --git a/src/jobs.c b/src/jobs.c
index f65435d..95e7ec4 100644
--- a/src/jobs.c
+++ b/src/jobs.c
@@ -196,7 +196,7 @@ setjobctl(int on)
return;
if (on) {
int ofd;
-   ofd = fd = open64(_PATH_TTY, O_RDWR);
+   ofd = fd = sh_open(_PATH_TTY, O_RDWR, 1);
if (fd < 0) {
fd += 3;
while (!isatty(fd))
@@ -887,8 +887,7 @@ static void forkchild(struct job *jp, union node *n, int 
mode)
ignoresig(SIGQUIT);
if (jp->nprocs == 0) {
close(0);
-   if (open64(_PATH_DEVNULL, O_RDONLY) != 0)
-   sh_error("Can't open %s", _PATH_DEVNULL);
+   sh_open(_PATH_DEVNULL, O_RDONLY, 0);
}
}
if (!oldlvl && iflag) {
diff --git a/src/redir.c b/src/redir.c
index 895140c..93abba3 100644
--- a/src/redir.c
+++ b/src/redir.c
@@ -55,6 +55,7 @@
 #include "output.h"
 #include "memalloc.h"
 #include "error.h"
+#include "trap.h"
 
 
 #define EMPTY -2   /* marks an unused slot in redirtab */
@@ -180,56 +181,83 @@ redirect(union node *redir, int flags)
 }
 
 
+static int sh_open_fail(const char *, int, int) __attribute__((__noreturn__));
+static int sh_open_fail(const char *pathname, int flags, int e)
+{
+   const char *word;
+   int action;
+
+   word = "open";
+   action = E_OPEN;
+   if (flags & O_CREAT) {
+   word = "create";
+   action = E_CREAT;
+   }
+
+   sh_error("cannot %s %s: %s", word, pathname, errmsg(e, action));
+}
+
+
+int sh_open(const char *pathname, int flags, int mayfail)
+{
+   int fd;
+   int e;
+
+   do {
+   fd = open64(pathname, flags, 0666);
+   e = errno;
+   } while (fd < 0 && e == EINTR && !pending_sig);
+
+   if (mayfail || fd >= 0)
+   return fd;
+
+   sh_open_fail(pathname, flags, e);
+}
+
+
 STATIC int
 openredirect(union node *redir)
 {
struct stat64 sb;
char *fname;
+   int flags;
int f;
 
switch (redir->nfile.type) {
case NFROM:
-   fname = redir->nfile.expfname;
-   if ((f = open64(fname, O_RDONLY)) < 0)
-   goto eopen;
+   flags = O_RDONLY;
+do_open:
+   f = sh_open(redir->nfile.expfname, flags, 0);
break;
case NFROMTO:
-   fname = redir->nfile.expfname;
-   if ((f = open64(fname, O_RDWR|O_CREAT, 0666)) < 0)
-   goto ecreate;
-   break;
+   flags = O_RDWR|O_CREAT;
+   goto do_open;
case NTO:
/* Take care of noclobber mode. */
if (Cflag) {
fname = redir->nfile.expfname;
if (stat64(fname, &sb) < 0) {
-   if ((f = open64(fname, O_WRONLY|O_CREAT|O_EXCL, 
0666)) < 0)
-   goto ecreate;
-   } else if (!S_ISREG(sb.st_mode)) {
-   if ((f = open64(fname, O_WRONLY, 0666)) < 0)
-   goto ecreate;
-   if (!fstat64(f, &sb) && S_ISREG(sb.st_mode)) {
-   close(f);
-   errno = EEXIST;
-   goto ecreate;
-   }
-   } else {
-   errno = EEXIST;
+  

Bug#436466: dash: Please optimise single command given to -c to exec it

2020-05-27 Thread Herbert Xu
On Sat, Nov 26, 2011 at 07:44:43PM -0600, Jonathan Nieder wrote:
> 
> Tim Connors wrote:
> 
> > Because of bug #642922 (archived, but has some interesting discussion),
> > this patch for this bug ended up being backed out.
> >
> > Hopefully this bug won't be forgotten by someone who understands the
> > problems in 642922, which seem to have been fixed elsewhere.
> 
> Thanks for the reminder, Tim.  Indeed, this won't be forgotten.

Looks it had been forgotten :)

I gather that the ocamlbuild bug has been fixed so can this be
reinstated please?

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#960249: inn2: Please enable DO_RNEWS_SAVE_BAD for rnews

2020-05-24 Thread Herbert Xu
On Sun, May 24, 2020 at 12:16:13PM +0200, Julien ÉLIE wrote:
> 
> I've just added a new "-b" flag to rnews so as to enable that option.
> Patch here (for possible inclusion in a new upload of the Debian package):
>   https://inn.eyrie.org/trac/changeset/10375/
> 
> Also note the "-v" option, already present but somehow undocumented in the
> man page, that will log the reason of the rejection.

Thanks for the change!
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#960249: inn2: Please enable DO_RNEWS_SAVE_BAD for rnews

2020-05-11 Thread Herbert Xu
On Mon, May 11, 2020 at 09:07:06PM +0200, Julien ÉLIE wrote:
> 
> I don't believe enabling this setting by default is a good idea.
> Nevertheless, you're right that having an inn.conf parameter to enable it,
> if the news admin wants, would be better.

Yes, a run-time configuration option would be the best.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#759230: shell: Always use explicit large file API

2020-05-07 Thread Herbert Xu
There are some remaining stat/readdir calls in dash that may lead
to spurious EOVERFLOW errors on 32-bit platforms.  This patch changes
them (as well as open(2)) to use the explicit large file API.

Reported-by: Tatsuki Sugiura 
Signed-off-by: Herbert Xu 

diff --git a/configure.ac b/configure.ac
index 5dab5aa..dbd97d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -144,8 +144,13 @@ AC_CHECK_FUNC(stat64,, [
AC_DEFINE(fstat64, fstat, [64-bit operations are the same as 32-bit])
AC_DEFINE(lstat64, lstat, [64-bit operations are the same as 32-bit])
AC_DEFINE(stat64, stat, [64-bit operations are the same as 32-bit])
+   AC_DEFINE(readdir64, readdir,
+ [64-bit operations are the same as 32-bit])
+   AC_DEFINE(dirent64, dirent,
+ [64-bit operations are the same as 32-bit])
 ])
 
+dnl OS X apparently has stat64 but not open64.
 AC_CHECK_FUNC(open64,, [
AC_DEFINE(open64, open, [64-bit operations are the same as 32-bit])
 ])
diff --git a/src/bltin/test.c b/src/bltin/test.c
index b7188df..c7fc479 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -473,17 +473,17 @@ static int isoperand(char **tp)
 static int
 newerf (const char *f1, const char *f2)
 {
-   struct stat b1, b2;
+   struct stat64 b1, b2;
 
 #ifdef HAVE_ST_MTIM
-   return (stat (f1, &b1) == 0 &&
-   stat (f2, &b2) == 0 &&
+   return (stat64(f1, &b1) == 0 &&
+   stat64(f2, &b2) == 0 &&
( b1.st_mtim.tv_sec > b2.st_mtim.tv_sec ||
 (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec 
> b2.st_mtim.tv_nsec )))
);
 #else
-   return (stat (f1, &b1) == 0 &&
-   stat (f2, &b2) == 0 &&
+   return (stat64(f1, &b1) == 0 &&
+   stat64(f2, &b2) == 0 &&
b1.st_mtime > b2.st_mtime);
 #endif
 }
@@ -491,17 +491,17 @@ newerf (const char *f1, const char *f2)
 static int
 olderf (const char *f1, const char *f2)
 {
-   struct stat b1, b2;
+   struct stat64 b1, b2;
 
 #ifdef HAVE_ST_MTIM
-   return (stat (f1, &b1) == 0 &&
-   stat (f2, &b2) == 0 &&
+   return (stat64(f1, &b1) == 0 &&
+   stat64(f2, &b2) == 0 &&
(b1.st_mtim.tv_sec < b2.st_mtim.tv_sec ||
 (b1.st_mtim.tv_sec == b2.st_mtim.tv_sec && (b1.st_mtim.tv_nsec 
< b2.st_mtim.tv_nsec )))
);
 #else
-   return (stat (f1, &b1) == 0 &&
-   stat (f2, &b2) == 0 &&
+   return (stat64(f1, &b1) == 0 &&
+   stat64(f2, &b2) == 0 &&
b1.st_mtime < b2.st_mtime);
 #endif
 }
@@ -509,10 +509,10 @@ olderf (const char *f1, const char *f2)
 static int
 equalf (const char *f1, const char *f2)
 {
-   struct stat b1, b2;
+   struct stat64 b1, b2;
 
-   return (stat (f1, &b1) == 0 &&
-   stat (f2, &b2) == 0 &&
+   return (stat64(f1, &b1) == 0 &&
+   stat64(f2, &b2) == 0 &&
b1.st_dev == b2.st_dev &&
b1.st_ino == b2.st_ino);
 }
diff --git a/src/cd.c b/src/cd.c
index b6742af..1ef1dc5 100644
--- a/src/cd.c
+++ b/src/cd.c
@@ -96,7 +96,7 @@ cdcmd(int argc, char **argv)
const char *path;
const char *p;
char c;
-   struct stat statb;
+   struct stat64 statb;
int flags;
int len;
 
@@ -132,7 +132,7 @@ dotdot:
c = *p;
p = stalloc(len);
 
-   if (stat(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
+   if (stat64(p, &statb) >= 0 && S_ISDIR(statb.st_mode)) {
if (c && c != ':')
flags |= CD_PRINT;
 docd:
diff --git a/src/expand.c b/src/expand.c
index 4a5d75a..ecd7ee5 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -1286,7 +1286,7 @@ expmeta(char *name, unsigned name_len, unsigned 
expdir_len)
int metaflag;
struct stat64 statb;
DIR *dirp;
-   struct dirent *dp;
+   struct dirent64 *dp;
int atend;
int matchdot;
int esc;
@@ -1363,7 +1363,7 @@ expmeta(char *name, unsigned name_len, unsigned 
expdir_len)
p++;
if (*p == '.')
matchdot++;
-   while (! int_pending() && (dp = readdir(dirp)) != NULL) {
+   while (! int_pending() && (dp = readdir64(dirp)) != NULL) {
if (dp->d_name[0] == '.' && ! matchdot)
continue;
if (pmatch(start, dp->d_name)) {
diff --git a/src/input.c b/src/input.c
index 177fd0a..7d6be63 100644
--- a/src/input.c
+++ b/src/input.c
@@ -397,7 +397,7 @@ setinput

Bug#935781: manpages: nsswitch.conf should document automount option

2019-08-26 Thread Herbert Xu
Package: manpages
Version: 4.16-2
Severity: normal

There is an undocumented automount option in nsswitch.conf which can
be used to control how auto.master(5) looks up sources starting with
the plus sign.  This should be documented.  Please see:

http://web.mit.edu/rhel-doc/5/RHEL-5-manual/Deployment_Guide-en-US/s1-nfs-client-config-autofs.html

Thanks,

-- System Information
Debian Release: 10.0
Kernel Version: Linux gwarestrin 5.2.0+ #3 SMP PREEMPT Tue Aug 20 22:11:45 AEST 
2019 x86_64 GNU/Linux



Bug#492354: closed by Sandro Tosi (Re: transmission: Add option to specify client IP)

2017-01-08 Thread Herbert Xu
reopen 492354
quit

On Sun, Jan 08, 2017 at 01:57:07AM +, Debian Bug Tracking System wrote:
> This is an automatic notification regarding your Bug report
> which was filed against the transmission package:
> 
> #492354: transmission: Add option to specify client IP
> 
> It has been closed by Sandro Tosi .
> 
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact Sandro Tosi 
>  by
> replying to this email.
> 
> 
> -- 
> 492354: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=492354
> Debian Bug Tracking System
> Contact ow...@bugs.debian.org with problems

> Date: Sat, 7 Jan 2017 20:51:37 -0500
> From: Sandro Tosi 
> To: 492354-d...@bugs.debian.org
> Subject: Re: transmission: Add option to specify client IP
> 
> https://trac.transmissionbt.com/ticket/1716 has been closed 6 years
> ago upstream, so i'm closing this bug as well - please follow up
> discussion with upstream on that ticker (or transmission github page)

The bug still exists in Debian so I'm reopening it.

If you have a problem with the upstream then it's up to you to
sort it out.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#75773: closed by Debian FTP Masters (Bug#796274: Removed package(s) from unstable)

2015-08-21 Thread Herbert Xu
reopen 75773
reassign 75773 gcc
quit

On Fri, Aug 21, 2015 at 01:47:05PM +, Debian Bug Tracking System wrote:
> 
> Dear submitter,
> 
> as the package gcc-4.6 has just been removed from the Debian archive
> unstable we hereby close the associated bug reports.  We are sorry
> that we couldn't deal with your issue properly.

The bug still exists in gcc.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#76754: closed by David Kalnischkies (Re: apt: race when installing new packages that conflict with old ones)

2015-08-14 Thread Herbert Xu
reopen 76754
quit

On Fri, Aug 14, 2015 at 07:42:14PM +, Debian Bug Tracking System wrote:
>
> Date: Fri, 14 Aug 2015 21:41:05 +0200
> From: David Kalnischkies 
> To: 76754-d...@bugs.debian.org
> Subject: Re: apt: race when installing new packages that conflict with old
>  ones
> User-Agent: Mutt/1.5.23 (2014-03-12)
> 
> Hi
> 
> On Sat, Nov 11, 2000 at 04:24:11PM +1100, herb...@gondor.apana.org.au wrote:
> > When apt-get tries to install a new package which conflicts and provides an
> > older one, it removes it and then installs the new package with two separate
> > dpkg commands.  This creates a window where packages depending on the old
> > package may fail.  For example, when I ran apt-get through dselect today,
> 
> Yes, but this is required to happen. The Conflicts-relation is defined
> to require the complete removal of the package the conflict is against
> before the new package can even be unpacked.
> 
> So, while unfortunately it is the best apt can do based on the request,
> so closing as not a bug.

What you can do is deconfigure the old package, install the new
package replacing the files in the old package (the new package
should probably have a Replaces header too), and then remove the
remaining bits of the old package.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



Bug#85535: closed by Debian FTP Masters (Bug#789156: Removed package(s) from unstable)

2015-06-23 Thread Herbert Xu
reopen 85535
reassign 85535 gcc
quit

On Tue, Jun 23, 2015 at 07:39:43AM +, Debian Bug Tracking System wrote:
> This is an automatic notification regarding your Bug report
> which was filed against the gcc,gcc-4.7 package:
> 
> #85535: builtin memcmp() could be optimised
> 
> It has been closed by Debian FTP Masters .
> 
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact Debian FTP Masters 
>  by
> replying to this email.

Reopening as bug is still present.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#204687: closed by Debian FTP Masters (Bug#789156: Removed package(s) from unstable)

2015-06-23 Thread Herbert Xu
reopen 204687
reassign 204687 gcc
quit

On Tue, Jun 23, 2015 at 07:36:09AM +, Debian Bug Tracking System wrote:
> This is an automatic notification regarding your Bug report
> which was filed against the gcc-4.6,gcc-4.7 package:
> 
> #204687: [PR 11877] gcc should use xor trick with -Os
> 
> It has been closed by Debian FTP Masters .
> 
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact Debian FTP Masters 
>  by
> replying to this email.

Reopening as bug is still present.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-27 Thread Herbert Xu
On Tue, Apr 28, 2015 at 05:15:59AM +0200, Marco d'Itri wrote:
> On Apr 28, Herbert Xu  wrote:
> 
> > The problem is that udev does more than just provide /dev.  It also
> > probes PCI devices for example.  So I need it to still do that but
> > leave /dev alone.
> Still, can you provide a use case? "I like my /dev/ static" is not 
> really one.

It is for me.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-27 Thread Herbert Xu
On Mon, Apr 27, 2015 at 05:30:44PM +0200, Michael Biebl wrote:
>
> If you don't use udev, simply don't start it?

The problem is that udev does more than just provide /dev.  It also
probes PCI devices for example.  So I need it to still do that but
leave /dev alone.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-26 Thread Herbert Xu
On Mon, Apr 27, 2015 at 05:27:16AM +0200, Michael Biebl wrote:
>
> You also missed to provide a compelling use case so far, why you need to
> mount /dev someplace else.

I don't need it mounted anywhere.  I use a static /dev.  udev_root
was just a way of telling it to get out of my way without screwing
other things up.

As you no longer provide that method, I need another way of telling
it to not screw with my /dev setup.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-26 Thread Herbert Xu
On Mon, Apr 27, 2015 at 05:01:54AM +0200, Michael Biebl wrote:
> Am 27.04.2015 um 04:50 schrieb Marco d'Itri:
> > On Apr 27, Herbert Xu  wrote:
> > 
> >> Well I still need it so please keep this open.
> > Can you clarify your use case?
> > Did you experiment with a non-default location for tmpdevfs on 
> > a systemd-enabled systemd?
> 
> A configurable UDEV_ROOT has been removed with the switch to devtmpfs
> [1]. That was over 3 years ago.
> 
> Herbert, you are coming too late.
> 
> [1]
> http://cgit.freedesktop.org/systemd/systemd/commit/?id=220893b3cbdbf8932f95c44811b169a8f0d33939

I'm running the latest kernel and it works perfectly without udev,
devtmpfs or systemd.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-26 Thread Herbert Xu
On Mon, Apr 27, 2015 at 04:50:51AM +0200, Marco d'Itri wrote:
> On Apr 27, Herbert Xu  wrote:
> 
> > Well I still need it so please keep this open.
> Can you clarify your use case?
> Did you experiment with a non-default location for tmpdevfs on 
> a systemd-enabled systemd?

I don't use systemd so obviously I am not able to try that.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#767551: closed by Michael Biebl (Re: Bug#767551: udev: udev_root support missing)

2015-04-26 Thread Herbert Xu
reopen 767551
quit

On Mon, Apr 27, 2015 at 01:51:11AM +, Debian Bug Tracking System wrote:
> This is an automatic notification regarding your Bug report
> which was filed against the udev package:
> 
> #767551: udev: udev_root support missing
> 
> It has been closed by Michael Biebl .
> 
> Their explanation is attached below along with your original report.
> If this explanation is unsatisfactory and you have not received a
> better one in a separate message then please contact Michael Biebl 
>  by
> replying to this email.
> 
> 
> -- 
> 767551: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=767551
> Debian Bug Tracking System
> Contact ow...@bugs.debian.org with problems

> Date: Mon, 27 Apr 2015 03:49:06 +0200
> From: Michael Biebl 
> To: 767551-d...@bugs.debian.org, herb...@gondor.apana.org.au
> Subject: Re: Bug#767551: udev: udev_root support missing
> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101
>  Thunderbird/31.6.0
> 
> On Sat, 1 Nov 2014 03:05:24 +0100 m...@linux.it (Marco d'Itri) wrote:
> > Control: tag -1 wishlist wontfix
> > 
> > On Nov 01, herb...@gondor.apana.org.au wrote:
> > 
> > > Up to version 175-7.2 udev has supported mounting itself in a
> > > location other than /dev through the udev_root option.  This
> > > option is now missing.  Please restore it as not everyone wishes
> > > to have udev mounted under /dev.
> > Sorry, support for this was removed because it was too much complex to 
> > maintain, none of the udev maintainers used or tested it and with very 
> > good approximation nobody ever used it.
> > (I am not even sure if this is supported anymore by the upstream 
> > maintainers and/or how it would interact with systemd.)
> 
> Don't see a point keeping this bug report open. Thus closing.

Well I still need it so please keep this open.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#782561: please backport commit ccfe8c3f7e52 from upstream

2015-04-20 Thread Herbert Xu
On Mon, Apr 20, 2015 at 09:17:22AM +0200, Romain Francoise wrote:
>
> For example, here's a photo I took of the crash on 3.18.4:
> 
>  https://orebokech.com/tmp/IMG_20150129_181653.jpg

OK I have reviewed this and indeed it does appear that the bug
can be triggered.  The trick appears to be making sure that your
input packet is fragmented.  That should then activate the kmalloc
path and lead to the memory corruption.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#501566: [MAN] Clarify two redirection mechanisms

2014-12-10 Thread Herbert Xu
Stephane CHAZELAS  wrote:
>
> Let's make it:
> 
>  [n1]>&n2Copy file descriptor n2 as stdout (or fd n1)
>  [n1]<&n2Copy file descriptor n2 as stdin (or fd n1)
> 
> That's more or less the POSIX wording. It may not be as
> descriptive as other ones, but I can't imagine anyone
> complaining about the correctness or accuracy of it.

Yes this sounds good to me.  Someone please create a patch for
it.

BTW, one of you guys dropped me from the CC list again.  Please
don't do that.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#576503: 'man dash' typo: "the shell .... proceed onto"

2014-11-16 Thread Herbert Xu
Stéphane Aulery  wrote:
> [-- text/plain, encoding 8bit, charset: utf-8, 12 lines --]
> 
> Hello,
> 
> Here is a small patch reported by a user of Debian [1]. Could you please
> integrate? Thank you for your help.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=576503

Patch applied.  However, I had to manually apply it because you did
not generate the patch from the top of the source tree with -p1.

Please ensure future submissions are generated correctly.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#646847: Redirection: interval file descriptor (0-9)

2014-11-16 Thread Herbert Xu
Stéphane Aulery  wrote:
> [-- text/plain, encoding 8bit, charset: utf-8, 12 lines --]
> 
> Hello,
> 
> Here is a small patch reported by a user of Debian [1]. Could you please
> integrate? Thank you for your help.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646847

Applied.
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#501566: dash: details of redirection/duplication in manpage are reversed

2014-11-11 Thread Herbert Xu
On Tue, Nov 11, 2014 at 02:23:21PM +0100, Stephen Shirley wrote:
>
> "[n1]>&n2Redirect standard output (or n1) to n2."
> 
> It doesn't cover the case where n2 is later changed, and how n1 does
> not follow this, but it's the simplest fix i see.

Yes that sounds much better.  Please send a patch.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#646847: dash.1 - Confusion between two pages c[h]sh

2014-11-10 Thread Herbert Xu
On Mon, Nov 10, 2014 at 04:02:41PM +0100, Harald van Dijk wrote:
> 
> Even if csh is intentionally in the "See also" section despite not
> being referenced anywhere else, is it also intentional that chsh is
> not in that section despite the earlier reference? Would a patch
> that leaves csh but also adds chsh be more appropriate, or do you
> prefer to leave it as it is now?

The see also section is not meant to be an exhaustive list of
all commands referred to in the manual.  It's meant to be a list
of manual entries related to dash.  So no I'm not going to add
chsh there just because there was an earlier reference.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#501566: dash: details of redirection/duplication in manpage are reversed

2014-11-10 Thread Herbert Xu
Stéphane Aulery  wrote:
> 
> --IS0zKkzwUGydFO0o
> Content-Type: text/plain; charset=utf-8
> Content-Disposition: inline
> Content-Transfer-Encoding: 8bit
> 
> forwarded 501566 d...@vger.kernel.org
> stop
> ---
> 
> Hello,
> 
> Here is a small patch reported by a user of Debian [1]. Could you please
> integrate? Thank you for your help.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=501566
> 
> Regards,
> 
> -- 
> Stéphane Aulery
> 
> --IS0zKkzwUGydFO0o
> Content-Type: text/x-diff; charset=utf-8
> Content-Disposition: attachment; filename="dash.1.fix-redirection-docs.diff"
> 
> --- dash.1.old2014-11-10 12:15:29.809398575 +0100
> +++ dash.1.new2014-11-10 12:17:03.401856125 +0100
> @@ -402,11 +402,11 @@
> .It [n] Ns \*[Lt] file
> Redirect standard input (or n) from file.
> .It [n1] Ns \*[Lt]& Ns n2
> -Duplicate standard input (or n1) from file descriptor n2.
> +Duplicate standard input (or n1) to file descriptor n2.
> .It [n] Ns \*[Lt]&-
> Close standard input (or n).
> .It [n1] Ns \*[Gt]& Ns n2
> -Duplicate standard output (or n1) to n2.
> +Duplicate standard output (or n1) from n2.
> .It [n] Ns \*[Gt]&-
> Close standard output (or n).
> .It [n] Ns \*[Lt]\*[Gt] file

I'm sorry but this patch looks wrong and the text looks correct
to me as is.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#646847: dash.1 - Confusion between two pages c[h]sh

2014-11-10 Thread Herbert Xu
Stéphane Aulery  wrote:
> [-- text/plain, encoding 8bit, charset: utf-8, 12 lines --]
> 
> Hello,
> 
> Here is a small patch reported by a user of Debian [1]. Could you please
> integrate? Thank you for your help.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646847

This patch also appears bogus as csh is an alternative to dash.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#646847: (none)

2014-11-10 Thread Herbert Xu
Stéphane Aulery  wrote:
> [-- text/plain, encoding 8bit, charset: utf-8, 19 lines --]
> 
> Subject Redirection: interval file descriptor (0-9)
> Reply-To: 
> 
> forwarded 646847 d...@vger.kernel.org
> stop
> ---
> 
> Hello,
> 
> Here is a small patch reported by a user of Debian [1]. Could you please
> integrate? Thank you for your help.
> 
> [1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=646847

Please resubmit the patch with a valid Subject.

Dash now has a patchwork project at

https://patchwork.kernel.org/project/dash/list/

if anyone is interested.

FWIW patchwork does not like empty Subjects.

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#379227: [PATCH 1/9] [BUILTIN] Handle embedded NULs correctly in printf

2014-10-27 Thread Herbert Xu
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=379227

On Sat, Jul 22, 2006 at 12:48:38PM +0200, A Mennucc wrote:
> Package: dash
> Version: 0.5.3-3
> Severity: normal
> 
> hi
> 
> here are the examples
> 
> $ bash -c 'echo -n -e "A\0102C\00D\0E" | hexdump -c'
> 000   A   B   C  \0   D  \0   E
> 007
> 
> $ /bin/echo -n -e "A\0102C\00D\0E" | hexdump -c
> 000   A   B   C  \0   D  \0   E
> 007
> 
> $ zsh -c 'echo -n -e "A\0102C\00D\0E" | hexdump -c'
> 000   A   B   C  \0   D  \0   E
> 007
> 
> $ dash -c 'echo -n  "A\0102C\00D\0E" | hexdump -c'
> 000   A   B   C
> 003
> 
> and also
> 
> $ dash -c 'echo -n  "ABC\0DEFGH" | hexdump -c'
> 000   A   B   C
> 003
> 
> As you see, dash 's builtin echo truncates the output at the first \0
> 
> a.
> 
> -- System Information:
> Debian Release: testing/unstable
>   APT prefers unstable
>   APT policy: (500, 'unstable'), (500, 'testing')
> Architecture: i386 (i686)
> Shell:  /bin/sh linked to /bin/bash
> Kernel: Linux 2.6.16-1-k7
> Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8)
> 
> Versions of packages dash depends on:
> ii  libc6 2.3.6-15   GNU C Library: Shared libraries
> 
> dash recommends no packages.
> 
> -- debconf information:
> * dash/sh: false
> 
> -- 
> Andrea Mennucc
>  "E' un mondo difficile. Che vita intensa!" (Tonino Carotone)

This patch fixes handling of embedded NULs using an approach similar
to the one taken by NetBSD.  In particular, we first determine the
length of the output string, and then use a sequence of Xs of the
same length as input to the underlying C printf to determine the
amount of leading and trailing padding.  Finally we replace the
Xs with the actual string before writing it out.

In order to print out the temporary string containing Xs and padding,
a new helper xasprintf is added.  Unlike asprintf though, our
xasprintf prints to the ash stack rather than using straight malloc
memory.

Signed-off-by: Herbert Xu 
---

 ChangeLog  |1 
 src/bltin/printf.c |   80 ---
 src/output.c   |   82 ++---
 src/output.h   |3 +
 4 files changed, 119 insertions(+), 47 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 46ef4c2..379672f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2014-10-27  Herbert Xu 
 
* Add printf support for format string a, A, and F.
+   * Handle embedded NULs correctly in printf.
 
 2014-10-13  Eric Blake 
 
diff --git a/src/bltin/printf.c b/src/bltin/printf.c
index e0ef912..213025f 100644
--- a/src/bltin/printf.c
+++ b/src/bltin/printf.c
@@ -40,7 +40,7 @@
 #include 
 #include 
 
-static int  conv_escape_str(char *);
+static int  conv_escape_str(char *, char **);
 static char*conv_escape(char *, int *);
 static int  getchr(void);
 static double   getdouble(void);
@@ -73,6 +73,53 @@ static char  **gargv;
} \
 }
 
+#define ASPF(sp, f, func) ({ \
+   int ret; \
+   switch ((char *)param - (char *)array) { \
+   default: \
+   ret = xasprintf(sp, f, array[0], array[1], func); \
+   break; \
+   case sizeof(*param): \
+   ret = xasprintf(sp, f, array[0], func); \
+   break; \
+   case 0: \
+   ret = xasprintf(sp, f, func); \
+   break; \
+   } \
+   ret; \
+})
+
+
+static int print_escape_str(const char *f, int *param, int *array, char *s)
+{
+   struct stackmark smark;
+   char *p, *q;
+   int done;
+   int len;
+   int total;
+
+   setstackmark(&smark);
+   done = conv_escape_str(s, &p);
+   q = stackblock();
+   len = p - q;
+
+   p = makestrspace(len, p);
+   memset(p, 'X', len - 1);
+   p[len - 1] = 0;
+
+   q = stackblock();
+   total = ASPF(&p, f, p);
+
+   len = strchrnul(p, 'X') - p;
+   memcpy(p + len, q, strchrnul(p + len, ' ') - (p + len));
+
+   out1mem(p, total);
+
+   popstackmark(&smark);
+   return done;
+}
+
+
 int printfcmd(int argc, char *argv[])
 {
char *fmt;
@@ -154,17 +201,14 @@ pc:
fmt[1] = 0;
switch (ch) {
 
-   case 'b': {
-   int done = conv_escape_str(getstr());
-   char *p = stackblock();
+   case 'b':
*fmt = 's';
-   PF(start, p);
/* escape if a \c was encountered */
- 

Bug#503840: [BUILTIN] Handle -- in dotcmd

2014-10-27 Thread Herbert Xu
commit 12ad48bb31b003eb6d3106478b7760a031969a36
Author: Herbert Xu 
Date:   Mon Oct 27 16:56:46 2014 +0800

[BUILTIN] Handle -- in dotcmd

This patch adds a nextopt call in dotcmd in order to handle --.

Reported-by: Stephane Chazelas 
Signed-off-by: Herbert Xu 

diff --git a/ChangeLog b/ChangeLog
index f015066..5212a9a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -10,6 +10,7 @@
* Use error instead of warnx for fatal errors in printf.
* Optimise handling of backslash octals in printf.
* Simplify echo command.
+   * Handle -- in dotcmd.
 
 2014-10-13  Eric Blake 
 
diff --git a/src/main.c b/src/main.c
index 00c5e00..985e8c4 100644
--- a/src/main.c
+++ b/src/main.c
@@ -321,15 +321,19 @@ dotcmd(int argc, char **argv)
 {
int status = 0;
 
-   if (argc >= 2) {/* That's what SVR2 does */
+   nextopt(nullstr);
+   argv = argptr;
+
+   if (*argv) {
char *fullname;
 
-   fullname = find_dot_file(argv[1]);
+   fullname = find_dot_file(*argv);
setinputfile(fullname, INPUT_PUSH_FILE);
commandname = fullname;
status = cmdloop(0);
popfile();
}
+
return status;
 }

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#482999: dash: builtin function 'jobs -p' doesn't work as expected

2014-10-27 Thread Herbert Xu
On Sat, Jun 28, 2008 at 04:25:28PM +0200, Miroslav Rudisin wrote:
> > On Mon, May 26, 2008 at 02:58:17PM +0200, Miroslav Rudisin wrote:
> > > children's PIDs are not printed when called in eval block
> > > 
> > > $ sleep 1000 &
> > > $ sleep 100 &
> > > $ jobs -p
> > > 14202
> > > 14201
> > > $ echo $(jobs -p)
> > > 
> > > $
> > 
> > Hi, I don't think that's a bug, the jobs builtin 'shall display the
> > status of jobs that were started in the current shell environment;'[0]
> > 
> > When running jobs in a subshell, you change the shell environment for
> > the jobs builtin.
> 
> ok, i understand. but then we have not reasonable way to store pids of 
> background
> process into shell variable...
> 
> $ sleep 1000 &
> $ sleep 100 &
> 
> $ for i in `jobs -p`; do echo $i; done  # doesn't work
> $ jobs -p | xargs   # doesn't work
> 
> only working way is redirecting output to the file
> 
> $ jobs -p > /tmp/pids   # this works

You should use $!.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#332954: [BUILTIN] Allow return in loop conditional to set exit status

2014-10-06 Thread Herbert Xu
commit f14b4626eb5c1c2fda137e7d1520c5f1cb7e85c4
Author: Herbert Xu 
Date:   Mon Oct 6 21:22:43 2014 +0800

[BUILTIN] Allow return in loop conditional to set exit status

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=332954

When return is used in a loop conditional the exit status will
be lost because we always set the exit status at the end of the
loop to that of the last command executed in the body.

This is counterintuitive and contrary to what most other shells do.

This patch fixes this by always preserving the exit status of
return when it is used in a loop conditional.

The patch was originally written by Gerrit Pape .

Reported-by: Stephane Chazelas 
Signed-off-by: Herbert Xu 

diff --git a/ChangeLog b/ChangeLog
index 1d88e13..297b81a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
* Exit without arguments in a trap should use status outside traps.
* Do not allow break to break across function calls.
* Move common skipcount logic into skiploop.
+   * Allow return in loop conditional to set exit status.
 
 2014-10-03  Herbert Xu 
 
diff --git a/src/eval.c b/src/eval.c
index daccf3d..7b341f3 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -387,8 +387,9 @@ evalloop(union node *n, int flags)
status = exitstatus;
skip = skiploop();
} while (!(skip & ~SKIPCONT));
+   if (skip != SKIPFUNC)
+   exitstatus = status;
loopnest--;
-   exitstatus = status;
 }
 

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#186994: closed by Stéphane Aulery (bash: tilde expansion inconsistency)

2014-04-24 Thread Herbert Xu
reopen 186994
quit

On Thu, Apr 24, 2014 at 09:33:11AM +, Debian Bug Tracking System wrote:
> 
> I close that bug. According to the logs, I think this bug is fixed since
> at least the 3.0.16 release. In any case, a simple test shows that this
> bug is fixed.

I just tested it with bash 4.2+dfsg-0.1 and it still does exactly
the same thing.

Did you actually test with -o posix?

Thanks,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#662003: apt-move with SHA256 support?

2012-03-30 Thread Herbert Xu
Hi:

Do we still need MD5 sums in the Packages file? If not I'd
suggest simply changing all existing references to md5 with
sha256 and it should just work.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#643564: dhcp: Stop using obsolete SOCK_PACKET and skip VLAN-tagged packets

2012-02-25 Thread Herbert Xu
Hi:

Here's a hack I just made up to make DHCP skip tagged packets.
In order to do so I've switched from the long-obsolete SOCK_PACKET
interface to AF_PACKET+SOCK_RAW.

Obviously you'll need to clean this up.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
diff --git a/common/lpf.c b/common/lpf.c
index e5dd1e2..36a14ee 100644
--- a/common/lpf.c
+++ b/common/lpf.c
@@ -35,6 +35,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include "includes/netinet/ip.h"
 #include "includes/netinet/udp.h"
@@ -65,11 +66,13 @@ void if_reinitialize_receive (info)
 int if_register_lpf (info)
struct interface_info *info;
 {
+   int val;
int sock;
-   struct sockaddr sa;
+   struct ifreq tmp;
+   struct sockaddr_ll sa;
 
/* Make an LPF socket. */
-   if ((sock = socket(PF_PACKET, SOCK_PACKET,
+   if ((sock = socket(PF_PACKET, SOCK_RAW,
   htons((short)ETH_P_ALL))) < 0) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
@@ -84,11 +87,20 @@ int if_register_lpf (info)
log_fatal ("Open a socket for LPF: %m");
}
 
+   val = 1;
+   setsockopt(sock, SOL_PACKET, PACKET_AUXDATA, &val, sizeof(val));
+
+   memcpy(&tmp, info->ifp, sizeof(tmp));
+   if (ioctl(sock, SIOCGIFINDEX, &tmp) < 0) {
+   log_fatal("Error getting interface index for \"%s\": %m", 
+ tmp.ifr_name);
+   }
+
/* Bind to the interface name */
memset (&sa, 0, sizeof sa);
-   sa.sa_family = AF_PACKET;
-   strncpy (sa.sa_data, (const char *)info -> ifp, sizeof sa.sa_data);
-   if (bind (sock, &sa, sizeof sa)) {
+   sa.sll_family = AF_PACKET;
+   sa.sll_ifindex = tmp.ifr_ifindex;
+   if (bind (sock, (struct sockaddr *)&sa, sizeof sa)) {
if (errno == ENOPROTOOPT || errno == EPROTONOSUPPORT ||
errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
errno == EAFNOSUPPORT || errno == EINVAL) {
@@ -294,7 +306,6 @@ ssize_t send_packet (interface, packet, raw, len, from, to, 
hto)
double hh [16];
double ih [1536 / sizeof (double)];
unsigned char *buf = (unsigned char *)ih;
-   struct sockaddr sa;
int result;
int fudge;
 
@@ -312,21 +323,25 @@ ssize_t send_packet (interface, packet, raw, len, from, 
to, hto)
(unsigned char *)raw, len);
memcpy (buf + ibufp, raw, len);
 
-   /* For some reason, SOCK_PACKET sockets can't be connected,
-  so we have to do a sentdo every time. */
-   memset (&sa, 0, sizeof sa);
-   sa.sa_family = AF_PACKET;
-   strncpy (sa.sa_data,
-(const char *)interface -> ifp, sizeof sa.sa_data);
-
-   result = sendto (interface -> wfdesc,
-buf + fudge, ibufp + len - fudge, 0, &sa, sizeof sa);
+   result = send (interface -> wfdesc,
+  buf + fudge, ibufp + len - fudge, 0);
if (result < 0)
log_error ("send_packet: %m");
return result;
 }
 #endif /* USE_LPF_SEND */
 
+struct tpacket_auxdata_new
+{
+   __u32   tp_status;
+   __u32   tp_len;
+   __u32   tp_snaplen;
+   __u16   tp_mac;
+   __u16   tp_net;
+   __u16   tp_vlan_tci;
+   __u16   tp_padding;
+};
+
 #ifdef USE_LPF_RECEIVE
 ssize_t receive_packet (interface, buf, len, from, hfrom)
struct interface_info *interface;
@@ -340,11 +355,38 @@ ssize_t receive_packet (interface, buf, len, from, hfrom)
unsigned char ibuf [1536];
unsigned bufix = 0;
unsigned paylen;
-
-   length = read (interface -> rfdesc, ibuf, sizeof ibuf);
+   struct cmsghdr *cmsg;
+   union {
+   struct cmsghdr cmsg;
+   char buf[CMSG_SPACE(sizeof(struct tpacket_auxdata_new))];
+   } cmsg_buf;
+   struct msghdr msg = {};
+   struct iovec iov;
+
+   iov.iov_base = ibuf;
+   iov.iov_len = sizeof ibuf;
+   msg.msg_iov = &iov;
+   msg.msg_iovlen = 1;
+   msg.msg_control = &cmsg_buf;
+   msg.msg_controllen = sizeof cmsg_buf;
+
+   length = recvmsg (interface -> rfdesc, &msg, 0);
if (length <= 0)
return length;
 
+   for (cmsg = CMSG_FIRSTHDR(&msg); cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
+   struct tpacket_auxdata_new *aux;
+
+   if (cmsg->cmsg_len < CMSG_LEN(sizeof(struct 
tpacket_auxdata_new)) ||
+   cmsg->cmsg_level != SOL_PACKET ||
+   cmsg-&g

Bug#485070: [PATCH] crypto: padlock-aes - Make module loading even quieter when hardware is missing

2011-08-02 Thread Herbert Xu
On Sat, Jul 30, 2011 at 01:50:12PM +0200, Jonathan Nieder wrote:
> When loading aes via the module alias, a padlock module failing to
> load due to missing hardware is not particularly notable.  With
> v2.6.27-rc1~1107^2~14 (crypto: padlock - Make module loading quieter
> when hardware isn't available, 2008-07-03), the padlock-aes module
> suppresses the relevant messages when the "quiet" flag is in use; but
> better to suppress this particular message completely, since the
> administrator can already distinguish such errors by the absence of a
> message indicating initialization failing or succeeding.
> 
> This avoids occasional messages in syslog of the form
> 
>   padlock_aes: VIA PadLock not detected.
> 
> Signed-off-by: Jonathan Nieder 


Patch applied.  Thanks Jonathan!
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#485070: cryptsetup: "FATAL" padlock_{aes,sha} error during boot

2011-07-29 Thread Herbert Xu
Ralf Jung  wrote:
> Hi,
> 
> as per request of Jonathan at http://bugs.debian.org/cgi-
> bin/bugreport.cgi?bug=485070, I am reporting the mentioned bug to this list 
> as 
> well:
> 
> With current Debian testing (Kernel 2.6.39), I am getting this error on each 
> boot:
> FATAL: Error inserting padlock_sha (/lib/modules/2.6.39-2-
> amd64/kernel/drivers/crypto/padlock-sha.ko): No such device
> I understand it is harmless, but it should still be fixed since it irritates 
> users suggesting something is seriously going wrong.

That message comes from user-space and needs to be fixed there.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#595063: read() builtin doesn't read integer value /proc files (but bash's does)

2010-11-28 Thread Herbert Xu
On Sat, Sep 04, 2010 at 07:35:04PM +, Jilles Tjoelker wrote:
> 
> > I attached an updated patch that corrects this pb by discarding the
> > buffer when opening a new file.
> 
> This discarding is still bad as it throws away valid data if the open
> file description is shared. This happens if stdin is redirected inside a

I'm with Jilles on this.  I also don't particularly feel like
bloating dash just because of the borked /proc interface when
there is a perfectly adequate work-around in "cat".

value=$(cat /proc/file)

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#596802: linux-image-2.6.32-5-xen-amd64: oops in skb_gso_segment

2010-09-15 Thread Herbert Xu
On Wed, Sep 15, 2010 at 02:12:03AM +0100, Ben Hutchings wrote:
> Herbert,
> 
> Does the warning below look like a symptom of the bug you fixed with
> this commit?

Yes it does look like.

Cheers,
-- 
Email: Herbert Xu 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#187808: procps: w reports pipelines incorrectly

2010-01-31 Thread Herbert Xu
On Sun, Jan 31, 2010 at 10:46:43PM +1100, Craig Small wrote:
>
> The offending line is:
>  if(tmp->tgid != tmp->tpgid) continue; 

I think this line should be replaced with

if (tmp->pgrp != tmp->tpgid)
continue

Otherwise we may end up showing background processes.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#187808: closed by Craig Small (Fixed in 3.2.6)

2010-01-31 Thread Herbert Xu
reopen 187808
quit
 
> Package: procps
> Version: 1:3.2.6-1
> 
> I no longer see this bug, I'm pretty sure back in 3.2.6 this was fixed.

Just tried it with 1:3.2.7-8 and it's still there.

$ w | grep yes
herbert  pts/13   192:S.1  26Aug09  4.00s  3.55s  0.00s yes
$ killall yes
$ w | grep pts/13
herbert  pts/13   192:S.1  26Aug09  5.00s  3.55s  3.55s /bin/bash
$ dpkg -s procps
Package: procps
Status: install ok installed
Priority: required
Section: admin
Installed-Size: 648
Maintainer: Craig Small 
Architecture: i386
Version: 1:3.2.7-8
Replaces: bsdutils (<< 2.9x-1), watch
Provides: watch
Depends: libc6 (>= 2.7-1), libncurses5 (>= 5.6+20071006-3), lsb-base (>= 3.0-10)
Recommends: psmisc
Conflicts: libproc-dev (<< 1:1.2.6-2), pgrep (<< 3.3-5), procps-nonfree, 
w-bassman (<< 1.0-3), watch
Conffiles:
 /etc/sysctl.conf 8103d5e65307db0d463ab5d10643fe99
 /etc/init.d/procps d0d73b0bafd25761fccf679d68788edd
Description: /proc file system utilities
 These are utilities to browse the /proc filesystem, which is not a real file
 system but a way for the kernel to provide information about the status of
 entries in its process table. (e.g. running, stopped or "zombie")
 Both command line and full screen utilities are provided. Ncurses is needed
 for the full screen utilities.  More information can be found at procps
 website http://procps.sf.net/
 .
 This package includes the following utilities: top, uptime, tload,
 free, vmstat, watch, skill, pmap, pgrep, slabtop and pwdx.
$ 

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#565404: linux-image-2.6.26-2-amd64: atl1e: TSO is broken

2010-01-23 Thread Herbert Xu
Ben Hutchings  wrote:
> 
> Based on the TCP sequence numbers, it seems that the length of the
> broken packet is correct but its IP header is wrong.
> 
> My understanding is that the length of the TCP payload in a GSO skb must
> always be a multiple of the gso_size, so that hardware is not required
> to adjust length fields.  So I see several possible explanations:

No, there is no such requirement.  The trailer skb can be of any
size less than or equal to gso_size.

However, if the hardware assumed this then yes it would explain
the problem.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#490644: gcc: -finline-small-functions is overzealous

2010-01-05 Thread Herbert Xu
On Mon, Jan 04, 2010 at 02:47:18PM +0100, Matthias Klose wrote:
> tags 490644 + moreinfo
> tags 490644 + upstream
> thanks
>
> please could you recheck with GCC-4.4 and GCC-4.5 (experimental) or 
> gcc-snapshot (unstable)? would it be possible to forwarded and track this 
> report upstream yourself?

It appears to be fixed in gcc 4.4.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#211784: closed by Guillem Jover (Re: Bug#211784: start-stop-daemon --stop returns before daemon exits unless --retry is used)

2009-11-24 Thread Herbert Xu
reopen 211784
reassign 211784 libc6
retitle 211784 Use start-stop-daemon --restart
quit

On Tue, Nov 24, 2009 at 06:36:03PM +, Debian Bug Tracking System wrote:
> 
> On Mon, 2004-08-30 at 08:02:46 +0200, Thomas Hood wrote:
> > On Mon, 2004-08-30 at 07:21, GOTO Masanori wrote:
> > > We're talking about libc6.postinst start-stop code (line:264).  We
> > > don't execute start-stop-daemon directly.  So I think --retry option
> > > issue is out of scope.
> > 
> > One should be able to call an initscript with the "restart"
> > argument in order to restart the service that it controls.  If
> > that doesn't work then there is a bug in the initscript.
> > Stopping and starting should also work without a "sleep" in
> > between.  This is something that should be addressed post-sarge.
> 
> I agree with Thomas, those init scripts are buggy. Also the
> functionality is already present in start-stop-daemon with the --retry
> option. The fact that --stop does not wait is explained clearly in
> the man pages, and I don't think it's s-s-d's fault if people expect
> it to do something it's not supposed to.
> 
> Thus closing.

Next time you close a bug, please look at the original report.
I never filed this against dpkg, it was reassigned by the maintainer
of the package it was filed against.

The original bug AFAICS is still there.
 
> Package: libc6
> Version: 2.3.2-7
> Severity: normal
> 
> The delay of one second between stop/start is too short for nis.
> On my system, it often takes between one and two seconds to shutdown
> nis.
> 
> This causes nis to be stopped but not started after a libc6 upgrade.
> 
> The solution is either to increase the delay to at least two seconds,
> or use a better method to determine when the stop has completed.
> 
> -- System Information
> Debian Release: testing/unstable
> Kernel Version: Linux gondolin 2.4.22-1-686-smp #1 SMP Sat Sep 6 00:06:59 EST 
> 2003 i686 GNU/Linux
> 
> Versions of the packages libc6 depends on:
> ii  libdb1-compat  2.1.3-7The Berkeley database routines [glibc 2.0/2.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#541835: [pkg-cryptsetup-devel] Bug#541835: crypto configuration / dependencies broken

2009-09-02 Thread Herbert Xu
Jonas Meurer  wrote:
> 
> i guess the best solution would be to improve the module dependency
> system. cipher meta-modules like 'aes' should depend on all available
> implementations. same for ivciphers, hashs, rng implementations etc.

We already do that for algorithms at least, they should all have
aliases of the form "ALG" or "ALG-all".

Things like chainiv/eseqiv should just be included always.  There
are unlikely to be any new algorithms of that type.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#429251: Debian Bug#429251: [PATCH] honor tab as IFS whitespace when splitting fields

2009-08-10 Thread Herbert Xu
I really loved your patch because it actually made dash smaller!

On Sun, Jul 05, 2009 at 12:45:49AM +0200, Stefan Potyra wrote:
>
> +static void
> +readcmd_handle_line(char *line, char **ap, size_t len)
> +{
> + struct arglist arglist;
> + struct strlist *sl;
> + char *s, *backup;
> +
> + /* ifsbreakup will fiddle with stack region... */
> + s = grabstackstr(line + len);
> + /* need a copy, so that delimiters aren't lost
> +  * in case there are more fields than variables */
> + if (len > 0) {
> + backup = sstrdup(line);
> + } else {
> + /* len==0, so just nullify all arguments...
> +  * otherwise memcpy (from sstrdup) would be called 
> +  * with equal memory regions.
> +  */

I think this is unnecessary.  See my revised patch below.  When
given the choice between a speed optimisation of an unusual case
and a smaller dash, the latter always wins :)

> + ungrabstackstr(backup, 0);
> + ungrabstackstr(s, 0);

The lovely thing about object stacks is that you don't have to
free the memory in places like this.  When read(1) completes the
whole object stack is obliterated so everything is freed.  As
this function is called just before read(1) returns we don't need
to free anything.
 
>  int
>  readcmd(int argc, char **argv)
>  {
> @@ -75,14 +150,14 @@ readcmd(int argc, char **argv)
>   char c;
>   int rflag;
>   char *prompt;
> - const char *ifs;
>   char *p;
> - int startword;
> - int status;
>   int i;
> + int res;
> + int status;

For future reference, please don't mix code clean-ups with actual
changes like this.  This makes it harder for people who read the
patch (possibly years later) to identify what has really changed.

I've gone through your patch and removed the bits which are merely
cosmetic fixes.  You're welcome to resubmit those that are still
applicable as a separate patch.

Anyway, this is what I ended up with:

diff --git a/ChangeLog b/ChangeLog
index e6a1d26..247b6e8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2009-08-11  Stefan Potyra 
+
+   * Honor tab as IFS whitespace when splitting fields in readcmd.
+
 2009-06-27  Herbert Xu 
 
* Fix quoted pattern patch breakage.
diff --git a/src/expand.c b/src/expand.c
index 7995d40..48c45e5 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -117,9 +117,6 @@ STATIC char *evalvar(char *, int);
 STATIC size_t strtodest(const char *, const char *, int);
 STATIC void memtodest(const char *, size_t, const char *, int);
 STATIC ssize_t varvalue(char *, int, int);
-STATIC void recordregion(int, int, int);
-STATIC void removerecordregions(int); 
-STATIC void ifsbreakup(char *, struct arglist *);
 STATIC void ifsfree(void);
 STATIC void expandmeta(struct strlist *, int);
 #ifdef HAVE_GLOB
@@ -412,7 +409,7 @@ lose:
 }
 
 
-STATIC void 
+void 
 removerecordregions(int endoff)
 {
if (ifslastp == NULL)
@@ -1001,7 +998,7 @@ value:
  * string for IFS characters.
  */
 
-STATIC void
+void
 recordregion(int start, int end, int nulonly)
 {
struct ifsregion *ifsp;
@@ -1028,7 +1025,7 @@ recordregion(int start, int end, int nulonly)
  * strings to the argument list.  The regions of the string to be
  * searched for IFS characters have been stored by recordregion.
  */
-STATIC void
+void
 ifsbreakup(char *string, struct arglist *arglist)
 {
struct ifsregion *ifsp;
diff --git a/src/expand.h b/src/expand.h
index 1862aea..405af0b 100644
--- a/src/expand.h
+++ b/src/expand.h
@@ -67,6 +67,9 @@ void expari(int);
 #define rmescapes(p) _rmescapes((p), 0)
 char *_rmescapes(char *, int);
 int casematch(union node *, char *);
+void recordregion(int, int, int);
+void removerecordregions(int); 
+void ifsbreakup(char *, struct arglist *);
 
 /* From arith.y */
 intmax_t arith(const char *);
diff --git a/src/miscbltin.c b/src/miscbltin.c
index 3f91bc3..cca0f6c 100644
--- a/src/miscbltin.c
+++ b/src/miscbltin.c
@@ -55,14 +55,73 @@
 #include "miscbltin.h"
 #include "mystring.h"
 #include "main.h"
+#include "expand.h"
+#include "parser.h"
 
 #undef rflag
 
 
+/** handle one line of the read command.
+ *  more fields than variables -> remainder shall be part of last variable.
+ *  less fields than variables -> remaining variables unset.
+ *
+ *  @param line complete line of input
+ *  @param ap argument (variable) list
+ *  @param len length of line including trailing '\0'
+ */
+static void
+readcmd_handle_line(char *line, char **ap, size_t len)
+{
+   struct arglist arglist;
+   struct strlist *sl;
+   char *s, *backup;
+
+   /* ifsbreakup will fiddle with stack region... */
+   s = grabstackstr(line + len);
+
+   /* need a copy, so that delimiters 

Bug#478166: linux-image-2.6.24-1-686: airo hang when loading because of aes

2009-06-01 Thread Herbert Xu
Ben Hutchings  wrote:
> 
> I believe geode_aes can be fixed by either (1) removing the MODULE_ALIAS
> declaration or (2) making the module initialisation function fail if the
> device is not present.  The latter behaviour is generally wrong for PCI
> drivers, but this device presumably cannot be hotplugged.

I was going to remove this alias but found that it was already
removed two years ago.  Please revise your theory based on this
new discovery :)
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#93268: closed by Antonio Radici (reply to anto...@dyne.org) (mutt: Bounced messages contain no From: headers)

2009-01-31 Thread Herbert Xu
open 93268
quit

> 8 years of wontfix, I suppose this will never be fixed.
>
> If this is a mutt bug/request this should be brought upstream,
> I don't think that maintaining a separate set of patches is
> a healthy practice.

This is no excuse for closing a bug.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} 
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org



Bug#455828: [EMAIL PROTECTED]: Bug#455828: dash: 4-argument test "test \( ! -e \)" yields an error]

2008-07-13 Thread Herbert Xu
On Sun, Jul 13, 2008 at 07:22:41PM +0800, Herbert Xu wrote:
> 
> I've fixed as below.

You'll also want these two patches.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
commit 74fbf95549bb68a2d40c0f91fdb04a0a720e3920
Author: Herbert Xu <[EMAIL PROTECTED]>
Date:   Sun Jul 13 20:05:56 2008 +0800

[BUILTIN] Made aexpr/oexpr non-recursive

Making these functions non-recursive is straightforward since they
carry no state.
    
Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

diff --git a/ChangeLog b/ChangeLog
index b2f7333..ef45102 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
 2008-06-13  Herbert Xu <[EMAIL PROTECTED]>
 
* Fixed 3,4-argument cases for test per POSIX.
+   * Made aexpr/oexpr non-recursive.
 
 2008-05-19  Herbert Xu <[EMAIL PROTECTED]>
 
diff --git a/src/bltin/test.c b/src/bltin/test.c
index 89d8d86..32a12fe 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -232,24 +232,31 @@ syntax(const char *op, const char *msg)
 static int
 oexpr(enum token n)
 {
-   int res;
-
-   res = aexpr(n);
-   if (t_lex(*++t_wp) == BOR)
-   return oexpr(t_lex(*++t_wp)) || res;
-   t_wp--;
+   int res = 0;
+
+   for (;;) {
+   res |= aexpr(n);
+   n = t_lex(t_wp[1]);
+   if (n != BOR)
+   break;
+   n = t_lex(*(t_wp += 2));
+   }
return res;
 }
 
 static int
 aexpr(enum token n)
 {
-   int res;
-
-   res = nexpr(n);
-   if (t_lex(*++t_wp) == BAND)
-   return aexpr(t_lex(*++t_wp)) && res;
-   t_wp--;
+   int res = 1;
+
+   for (;;) {
+   if (!nexpr(n))
+   res = 0;
+   n = t_lex(t_wp[1]);
+   if (n != BAND)
+   break;
+   n = t_lex(*(t_wp += 2));
+   }
return res;
 }
 
commit da1dd1f233b5235f2e5750cf2764ba87f06c590f
Author: Herbert Xu <[EMAIL PROTECTED]>
Date:   Sun Jul 13 22:07:08 2008 +0800

[BUILTIN] Made t_lex reentrant

The previous two changes were broken because t_lex uses global state.
This patch removes that by making t_wp local to t_lex.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

diff --git a/ChangeLog b/ChangeLog
index ef45102..5565e06 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,7 @@
 
* Fixed 3,4-argument cases for test per POSIX.
* Made aexpr/oexpr non-recursive.
+   * Made t_lex reentrant.
 
 2008-05-19  Herbert Xu <[EMAIL PROTECTED]>
 
diff --git a/src/bltin/test.c b/src/bltin/test.c
index 32a12fe..8e7077a 100644
--- a/src/bltin/test.c
+++ b/src/bltin/test.c
@@ -142,8 +142,8 @@ static int nexpr(enum token);
 static int primary(enum token);
 static int binop(void);
 static int filstat(char *, enum token);
-static enum token t_lex(char *);
-static int isoperand(void);
+static enum token t_lex(char **);
+static int isoperand(char **);
 static int newerf(const char *, const char *);
 static int olderf(const char *, const char *);
 static int equalf(const char *, const char *);
@@ -207,7 +207,7 @@ testcmd(int argc, char **argv)
}
}
 
-   n = t_lex(*argv);
+   n = t_lex(argv);
 
 eval:
t_wp = argv;
@@ -236,10 +236,10 @@ oexpr(enum token n)
 
for (;;) {
res |= aexpr(n);
-   n = t_lex(t_wp[1]);
+   n = t_lex(t_wp + 1);
if (n != BOR)
break;
-   n = t_lex(*(t_wp += 2));
+   n = t_lex(t_wp += 2);
}
return res;
 }
@@ -252,10 +252,10 @@ aexpr(enum token n)
for (;;) {
if (!nexpr(n))
res = 0;
-   n = t_lex(t_wp[1]);
+   n = t_lex(t_wp + 1);
if (n != BAND)
break;
-   n = t_lex(*(t_wp += 2));
+   n = t_lex(t_wp += 2);
}
return res;
 }
@@ -264,7 +264,7 @@ static int
 nexpr(enum token n)
 {
if (n == UNOT)
-   return !nexpr(t_lex(*++t_wp));
+   return !nexpr(t_lex(++t_wp));
return primary(n);
 }
 
@@ -277,10 +277,10 @@ primary(enum token n)
if (n == EOI)
return 0;   /* missing expression */
if (n == LPAREN) {
-   if ((nn = t_lex(*++t_wp)) == RPAREN)
+   if ((nn = t_lex(++t_wp)) == RPAREN)
return 0;   /* missing expression */
res = oexpr(nn);
-   if (t_lex(*++t_wp) != RPAREN)
+   if (t_lex(++t_wp) != RPAREN)
syntax(NULL, "closing paren expected");
return res;
}
@@ -300,7 +300,7 @@ primary(enum token n)

Bug#490644: Acknowledgement (gcc: -finline-small-functions is overzealous)

2008-07-13 Thread Herbert Xu
On Sun, Jul 13, 2008 at 10:27:42AM +, Debian Bug Tracking System wrote:
> 
> Thank you for filing a new Bug report with Debian.

Here is the test file.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
#include 

enum token {
	EOI,
	FILRD,
	FILWR,
	FILEX,
	FILEXIST,
	FILREG,
	FILDIR,
	FILCDEV,
	FILBDEV,
	FILFIFO,
	FILSOCK,
	FILSYM,
	FILGZ,
	FILTT,
	FILSUID,
	FILSGID,
	FILSTCK,
	FILNT,
	FILOT,
	FILEQ,
	FILUID,
	FILGID,
	STREZ,
	STRNZ,
	STREQ,
	STRNE,
	STRLT,
	STRGT,
	INTEQ,
	INTNE,
	INTGE,
	INTGT,
	INTLE,
	INTLT,
	UNOT,
	BAND,
	BOR,
	LPAREN,
	RPAREN,
	OPERAND
};

enum token_types {
	UNOP,
	BINOP,
	BUNOP,
	BBINOP,
	PAREN
};

static struct t_op {
	const char *op_text;
	short op_num, op_type;
} const ops [] = {
	{"-r",	FILRD,	UNOP},
	{"-w",	FILWR,	UNOP},
	{"-x",	FILEX,	UNOP},
	{"-e",	FILEXIST,UNOP},
	{"-f",	FILREG,	UNOP},
	{"-d",	FILDIR,	UNOP},
	{"-c",	FILCDEV,UNOP},
	{"-b",	FILBDEV,UNOP},
	{"-p",	FILFIFO,UNOP},
	{"-u",	FILSUID,UNOP},
	{"-g",	FILSGID,UNOP},
	{"-k",	FILSTCK,UNOP},
	{"-s",	FILGZ,	UNOP},
	{"-t",	FILTT,	UNOP},
	{"-z",	STREZ,	UNOP},
	{"-n",	STRNZ,	UNOP},
	{"-h",	FILSYM,	UNOP},		/* for backwards compat */
	{"-O",	FILUID,	UNOP},
	{"-G",	FILGID,	UNOP},
	{"-L",	FILSYM,	UNOP},
	{"-S",	FILSOCK,UNOP},
	{"=",	STREQ,	BINOP},
	{"!=",	STRNE,	BINOP},
	{"<",	STRLT,	BINOP},
	{">",	STRGT,	BINOP},
	{"-eq",	INTEQ,	BINOP},
	{"-ne",	INTNE,	BINOP},
	{"-ge",	INTGE,	BINOP},
	{"-gt",	INTGT,	BINOP},
	{"-le",	INTLE,	BINOP},
	{"-lt",	INTLT,	BINOP},
	{"-nt",	FILNT,	BINOP},
	{"-ot",	FILOT,	BINOP},
	{"-ef",	FILEQ,	BINOP},
	{"!",	UNOT,	BUNOP},
	{"-a",	BAND,	BBINOP},
	{"-o",	BOR,	BBINOP},
	{"(",	LPAREN,	PAREN},
	{")",	RPAREN,	PAREN},
	{0,	0,	0}
};

static char **t_wp;
static struct t_op const *t_wp_op;

static const struct t_op *getop(const char *s)
{
	const struct t_op *op;

	for (op = ops; op->op_text; op++) {
		if (strcmp(s, op->op_text) == 0)
			return op;
	}

	return NULL;
}

static int
isoperand(void)
{
	struct t_op const *op;
	char *s, *t;

	if ((s  = *(t_wp+1)) == 0)
		return 1;
	if ((t = *(t_wp+2)) == 0)
		return 0;

	op = getop(s);
	return op && op->op_type == BINOP;
}

static enum token
t_lex(char *s)
{
	struct t_op const *op;

	if (s == 0) {
		t_wp_op = (struct t_op *)0;
		return EOI;
	}

	op = getop(s);
	if (op && !(op->op_type == UNOP && isoperand()) &&
	!(op->op_num == LPAREN && *(t_wp+1) == 0)) {
		t_wp_op = op;
		return op->op_num;
	}

	t_wp_op = (struct t_op *)0;
	return OPERAND;
}

int
testcmd(int argc, char **argv)
{
	const struct t_op *op;
	int res;

	if (*argv[0] == '[') {
		if (*argv[--argc] != ']')
			error("missing ]");
		argv[argc] = NULL;
	}

	if (argc < 2)
		return 1;

	t_wp = &argv[1];

	/*
	 * POSIX prescriptions: he who wrote this deserves the Nobel
	 * peace prize.
	 */
	if (argc == 4) {
		op = getop(t_wp[1]);
		if (op && op->op_type == BINOP) {
			res = binop();
			goto done;
		}
	}

	if (argc >= 4 || argc <= 5) {
		if (!strcmp(*t_wp, "(") && !strcmp(argv[argc - 1], ")")) {
			argv[--argc] = NULL;
			t_wp++;
		}
	}

	res = oexpr(t_lex(*t_wp));

	if (*t_wp != NULL && *++t_wp != NULL)
		syntax(*t_wp, "unexpected operator");

done:
	return !res;
}


Bug#487355: Bug forwarded upstream

2008-06-24 Thread Herbert Xu
On Tue, Jun 24, 2008 at 04:27:20PM +0200, Leo Antunes wrote:
> 
> This had already been requested upstream a while ago and they seem to
> have dismissed the idea. I'm requesting it again pointing to this bug.

Thanks!

For those reading from upstream, even if transmission didn't crash
or freeze every other time a new torrent is added, the fact that
Gnome and X does (even Windows is more stable these days) means
that auto-saves are essential.

Alternatively if transmission-daemon + transmission-gui did everything
that transmission did then auto-saves wouldn't be so important.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#65458: closed by Clint Adams <[EMAIL PROTECTED]> (Re: Bug#65458: (no subject))

2008-05-19 Thread Herbert Xu
reopen 65458
reassign 65458 libc6
quit

On Mon, May 19, 2008 at 01:03:10PM +, Debian Bug Tracking System wrote:
> 
> This is an automatic notification regarding your Bug report
> which was filed against the libc6 package:
> 
> #65458: sed: regexp performance woeful
> 
> It has been closed by Clint Adams <[EMAIL PROTECTED]>.

Until the fixed package enters Debian I can't verify this.  So
please keep it open.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#467065: dash bug with "if" in a pipe: patch included

2008-02-24 Thread Herbert Xu
On Sun, Feb 24, 2008 at 11:43:34AM -0800, Larry Doolittle wrote:
> (Herbert: for context, see
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=467065 )
> 
> This is a real bug in upstream dash, which has existed since at
> least dash-0.5.1 (July 2004).  It is a latent bug in cmdtxt()
> (which I think applies only to pipes) as it handles "if" commands.
> The attached patch fixes it for me.

Good catch.  Thanks Larry!

I'll apply this patch.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#461507: angband: please make 3.0.6 scrolling behaviour optional

2008-01-19 Thread Herbert Xu
On Sat, Jan 19, 2008 at 01:59:38AM -0800, Joshua Rodman wrote:
>
> If keeping the character centered at all times is sufficiently
> non-irritating then set center_player on, = for options, 2 for display.
> If you really want to be able to move to the very edge of the panel
> before it is recentered, then I recommend you post your rationale to the
> folks at rec.games.roguelike.angband, who significantly are players, but
> also significantly decide the steering of the game, design and UI both.

Well I still contend that forcing this change on the player without an
option is undesirable.  So please keep this bug open until that is for
future reference.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#461507: angband: please make 3.0.6 scrolling behaviour optional

2008-01-19 Thread Herbert Xu
On Fri, Jan 18, 2008 at 10:50:46PM -0800, Joshua Rodman wrote:
>
> > The new scrolling behaviour of 3.0.6 where the maps is automatically
> > scrolled when the player is more than 1/4 away from the centre is
> > extremely annoying to me.
> > 
> > In the old days major changes would be done as an option rather than
> > forced on everyone.  So I'd really appreciate it if this too can be
> > made an option.
> 
> This is a normal angband preference, with the defaults set (I believe)
> upstream, and your angband prefs shouldn't be altered by the update.  If
> the package does alter them, that is bad.

Hmm as far as I can see there isn't an option for this behaviour at
all.  If there is I'd be grateful to know where it is.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#456990: dash: set +o does not conform to POSIX/SUSv3

2007-12-22 Thread Herbert Xu
On Wed, Dec 19, 2007 at 11:18:37AM +, Gerrit Pape wrote:
> Hi Richard, thanks for the good bug report plus patch.
> 
> Hi Herbert, please see below, and
>  http://bugs.debian.org/456990
> with pointers to freebsd and netbsd ash.
> 
> I agree this is a bug and should be fixed, Richard's patch looks good to
> me.

Patch applied.  Thanks a lot.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#456399: [PATCH] [EVAL] Fix unaligned trap on sparc

2007-12-22 Thread Herbert Xu
On Wed, Dec 19, 2007 at 10:39:11AM +, Gerrit Pape wrote:
> From: Steve Langasek <[EMAIL PROTECTED]>
> 
> dash dies on sparc with a SIGBUS due to an arithmetic error introduced
> with commit 03b4958, this patch fixes it.

Thanks for catching this! I really hate gcc's void * arithmetic
extension.

>   /* Reserve one extra spot at the front for shellexec. */
> - argv = nargv = stalloc(sizeof (char *) * (argc + 2)) + 1;
> + argv = nargv = ((char **)stalloc(sizeof (char *) * (argc + 2))) + 1;

BTW, I've modified this slightly to remove the need to cast.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
commit 745e09faa22eb06e00588b198210b302c860a988
Author: Steve Langasek <[EMAIL PROTECTED]>
Date:   Sun Dec 23 11:02:26 2007 +0800

[EVAL] Fix bad pointer arithmetic in evalcommand

dash dies on sparc with a SIGBUS due to an arithmetic error introduced
with commit 03b4958, this patch fixes it.
---

> Hi Gerrit,
>
> dash 0.5.4-3 dies on sparc with a SIGBUS due to an arithmetic error
> introduced with the patch
> 0030-EXEC-Fixed-execing-of-scripts-with-no-hash-bang.diff.  The
    > attached
> patch fixes the problem.

Signed-off-by: Herbert Xu <[EMAIL PROTECTED]>

diff --git a/ChangeLog b/ChangeLog
index de37261..e72849c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-12-23  Steve Langasek <[EMAIL PROTECTED]>
+
+   * Fixed bad pointer arithmetic in evalcommand.
+
 2007-11-11  Herbert Xu <[EMAIL PROTECTED]>
 
* Removed noexpand/length check on eofmark.
diff --git a/src/eval.c b/src/eval.c
index a8feaa0..77291b4 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -722,7 +722,8 @@ evalcommand(union node *cmd, int flags)
}
 
/* Reserve one extra spot at the front for shellexec. */
-   argv = nargv = stalloc(sizeof (char *) * (argc + 2)) + 1;
+   nargv = stalloc(sizeof (char *) * (argc + 2));
+   argv = ++nargv;
for (sp = arglist.list ; sp ; sp = sp->next) {
TRACE(("evalcommand arg: %s\n", sp->text));
*nargv++ = sp->text;



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#456398: [PATCH] [ARITH] If imaxdiv() isn't available, use / and % operators

2007-12-20 Thread Herbert Xu
On Thu, Dec 20, 2007 at 02:34:38PM +, Gerrit Pape wrote:
> Although in posix, imaxdiv() isn't implemented on Debian/alpha, causing
> dash to fail to build.  So use / and % operators if imaxdiv() isn't
> available.
> 
>  http://bugs.debian.org/456398
> 
> Signed-off-by: Gerrit Pape <[EMAIL PROTECTED]>

Thanks a lot Gerrit.  I'll add it to the tree.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#456398: [PATCH] [ARITH] Don't use imaxdiv(), but /, % operators

2007-12-20 Thread Herbert Xu
On Thu, Dec 20, 2007 at 12:48:51PM +, Gerrit Pape wrote:
> Although in posix, imaxdiv() isn't available on Debian/alpha, causing
> dash to fail to build.  So don't use imaxdiv(), but / and % operators.
> 
>  http://bugs.debian.org/456398
> 
> Signed-off-by: Gerrit Pape <[EMAIL PROTECTED]>

Thanks for the patch.  I'd prefer a version that provides an
implementation of imaxdiv if it doesn't exist.  It's how we
deal with other functions that might be missing, e.g. due to
us using uclibc.

Also the reason I used it in the first place IIRC is because
it generated better code with the current gcc so I'd like to
keep it where it's available.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#40207: ntp: ntpd refuses to step the clock

2007-12-10 Thread Herbert Xu
On Tue, Dec 11, 2007 at 12:37:17AM +0100, Peter Eisentraut wrote:
> Can anyone still reproduce this with a recent set of software?

No the machine in question died long ago.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#431320: NAK: Arithmetic argument NULL must be handled as Not A Number

2007-10-16 Thread Herbert Xu
On Wed, Oct 17, 2007 at 06:07:44AM +0200, Oleg Verych wrote:
>
> > $ bash -o posix -c '[ "" -lt 3 ]'
> > bash: line 0: [: : integer expression expected
> 
> > $ bash -o posix -c '[ " " -lt 3 ]'
> 
> I know, but see above :) How many broken and slow things its developer
> brought to the world... This must be left behind and remembered as
> classic case of "what not to do".

Right, I didn't realise that your patch actually treated this
case consistently.

I've applied your patch (modified for the current dash tree).
Thanks!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#431320: Re, NAK: Arithmetic argument NULL must be handled as Not A Number

2007-10-16 Thread Herbert Xu
On Tue, Oct 16, 2007 at 10:30:15PM +0200, Oleg Verych wrote:
>
> > 1) The real Korn shell does the same thing;
> > 2) It makes the code bigger :)
> 
> Well, i don't know all that korn/bourne/tcsh/bash/whatever hell.

The POSIX specification is mostly based on the Korn shell and
it is the prototypical POSIX compliant shell.

However, more importantly this behaviour is consistent with
POSIX.  Since one of the primary aims of dash is to be as small
as possible (the one being as fast as possible) while staying
within the realms of POSIX-compliance, I'd rather not apply
this patch.  Unless of course if you can show me a way to do
it while at the same time making dash smaller :)

> Also, this hides real bugs, when arithmetical comparsion succeeds, even

I think this is debatable.  Even if dash made this an error it
still may escape detection because the test command is not a
special built-in and cannot cause the whole script to abort.
So all this will do is print something to stderr and cause the
test to return false instead of a possible true value.

BTW, even bash is not completely consistent here:

$ bash -o posix -c '[ "" -lt 3 ]'
bash: line 0: [: : integer expression expected
$ bash -o posix -c '[ " " -lt 3 ]'
$

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#445651: posh: Conditional operator evaluates both arguments

2007-10-12 Thread Herbert Xu
On Fri, Oct 12, 2007 at 10:45:14AM -0400, Clint Adams wrote:
> On Mon, Oct 08, 2007 at 08:35:42AM +0800, Herbert Xu wrote:
> > Yes.
> 
> Based on the contents of tests/arith.t, I'm wondering if this is somehow
> intentional.

I've tested every other shell and they all disagree with posh,
except pdksh :)

$ bash -c 'echo $((0 ? x=3 : 4)); echo $x'
4

$ ksh93 -c 'echo $((0 ? x=3 : 4)); echo $x'
4

$

In any case, behaving differently depending on a pair of brackets
is strange:

$ posh -c 'echo $((0 ? x=3 : 4)); echo $x'
4
3
$ posh -c 'echo $((0 ? (x=3) : 4)); echo $x'
4

$

Either it should assign in both cases or neither.

As far as POSIX is concerned, it defers to ISO C on this.  The
semantics in ISO C is quite clear, that is, the assignment should
not occur.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#329025: Please consider implementing SuSv3 compliant $(()) arithmetics

2007-10-11 Thread Herbert Xu
On Wed, Nov 30, 2005 at 01:15:11PM +0100, Gerrit Pape wrote:
> forwarded 329025 upstream
> quit
> 
> Hi Herbert, please see http://bugs.debian.org/329025 and comments below.
> I personally think there's one example dash should support.

OK, I've just pushed an update with assignment support.  Please
let me know if there are any problems with it.

Thanks,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#418774: dash gives "Syntax error: Bad substitution" on valid syntax

2007-10-08 Thread Herbert Xu
reopen 418774
quit

On Fri, Oct 05, 2007 at 07:36:47AM -0400, Paul Smith wrote:
>
> > /bin/sh -c 'if false; then d="${foo/bar}"; fi'
> 
> Note the "if false;...".  The POSIX spec, in the sections we have quoted
> above, is clear that this should NOT be an error, because that reference
> is never expanded.

Fair enough.  I've fixed it as follows.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
--
3df3edd13389ae768010bfacee5612346b413e38
diff --git a/ChangeLog b/ChangeLog
index 1db14ac..69ba464 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-10-08  Herbert Xu <[EMAIL PROTECTED]>
+
+   * Report substition errors at expansion time.
+
 2007-10-06  Herbert Xu <[EMAIL PROTECTED]>
 
* Add pushstackmark.
diff --git a/src/expand.c b/src/expand.c
index e3e5d8f..54fe908 100644
--- a/src/expand.c
+++ b/src/expand.c
@@ -749,6 +749,10 @@ evalvar(char *p, int flag)
 
varflags = *p++;
subtype = varflags & VSTYPE;
+
+   if (!subtype)
+   sh_error("Bad substitution");
+
quoted = flag & EXP_QUOTED;
var = p;
easy = (!quoted || (*var == '@' && shellparam.nparam));
diff --git a/src/parser.c b/src/parser.c
index d0e0553..4b8a5fe 100644
--- a/src/parser.c
+++ b/src/parser.c
@@ -1204,9 +1204,8 @@ varname:
USTPUTC(cc, out);
}
else
-badsub:synerror("Bad substitution");
+   goto badsub;
 
-   STPUTC('=', out);
if (subtype == 0) {
switch (c) {
case ':':
@@ -1216,7 +1215,7 @@ badsub:   synerror("Bad substitution");
default:
p = strchr(types, c);
if (p == NULL)
-   goto badsub;
+   break;
subtype |= p - types + VSNORMAL;
break;
case '%':
@@ -1234,6 +1233,7 @@ badsub:   synerror("Bad substitution");
}
}
} else {
+badsub:
pungetc();
}
*((char *)stackblock() + typeloc) = subtype;
@@ -1242,6 +1242,7 @@ badsub:   synerror("Bad substitution");
if (dblquote)
dqvarnest++;
}
+   STPUTC('=', out);
}
goto parsesub_return;
 }



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#445651: posh: Conditional operator evaluates both arguments

2007-10-07 Thread Herbert Xu
On Sun, Oct 07, 2007 at 12:32:08PM -0400, Clint Adams wrote:
>
> > Putting brackets around x = 3 seems to fix it so this could be
> > a parse error.
> 
> Parentheses, I assume.

Yes.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#185584: xserver-xfree86: X server should retry xfs connection

2007-10-07 Thread Herbert Xu
On Tue, Jul 24, 2007 at 02:23:04PM +0200, Julien Cristau wrote:
>
> doesn't "xset fp rehash" do that?  (I have no idea, I've never used a
> font server.)

Unfortunately it doesn't seem to help.  Now I'll need to restart
my X server.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#23233: Debian CVS bugs

2007-10-05 Thread Herbert Xu
These CVS bugs are still outstanding and should remain open.
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#445210: closed by Pierre Habouzit <[EMAIL PROTECTED]> (Re: Bug#445210: libc6: glob(3) doesn't treat \ correctly)

2007-10-04 Thread Herbert Xu
reopen 445210
quit

On Thu, Oct 04, 2007 at 08:27:04AM +, Debian Bug Tracking System wrote:
>
> and the test case on http://sourceware.org/bugzilla/show_bug.cgi?id=3996 works
> as well.
> 
> Please check your environment, the libc works.

There were other tests in the bug report.

$ cat a.c
#include 
#include 

int main() {
glob_t pglob;
printf("%d\n", glob("\\/*", 0, 0, &pglob));
printf("%d\n", glob("/*", 0, 0, &pglob));
return 0;
}
$ make a
cc a.c   -o a
$ ./a
3
0
$

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#65458: closed by Touko Korpela <[EMAIL PROTECTED]> (Should be fixed now)

2007-09-26 Thread Herbert Xu
reopen 65458
quit

On Sat, Sep 15, 2007 at 09:21:04PM +, Debian Bug Tracking System wrote:
>
> This slowness should be fixed already in etch (and maybe even sarge).
> Please reopen if you can still reproduce it in current version.

The second problem seems to be fixed but the original problem
is now back:

$ time sed '/^$/d' > /dev/null < /var/lib/dpkg/available

real0m2.011s
user0m2.004s
sys 0m0.004s
$ time mawk '!/^$/ { print; }' > /dev/null < /var/lib/dpkg/available

real0m0.141s
user0m0.128s
sys 0m0.012s
$

Note that my machine is now much faster :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#431320: [EMAIL PROTECTED]: Bug#431320: dash, test: Arithmetic argument NULL must be handled as Not A Number]

2007-09-22 Thread Herbert Xu
On Wed, Sep 19, 2007 at 09:36:12AM +, Gerrit Pape wrote:
>
> Subject: [patch 01/03] dash, test: whitespace cleanup (as done by default by 
> emacs)

Applied.

> Subject: [patch 02/03] dash, test: little size and speed optimizations

Applied partially.

> @@ -259,16 +259,16 @@
>  binop(void)
>  {
>   const char *opnd1, *opnd2;
> - struct t_op const *op;
> + short op_num;
>  
>   opnd1 = *t_wp;
>   (void) t_lex(*++t_wp);
> - op = t_wp_op;
>  
>   if ((opnd2 = *++t_wp) == (char *)0)
> - syntax(op->op_text, "argument expected");
> + syntax(t_wp_op->op_text, "argument expected");
>  
> - switch (op->op_num) {
> + op_num = t_wp_op->op_num;
> + switch (op_num) {

I don't see how this hunk can produce a positive effect so
I've dropped it.

> Subject: [patch 03/03] dash, test: recognize NULL argument as not a number

Nack because

1) The real Korn shell does the same thing;
2) It makes the code bigger :)

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#431320: More questions about test built-in (Bug#431320: dash, test: [...])

2007-09-21 Thread Herbert Xu
On Wed, Sep 19, 2007 at 04:58:49PM +0200, Oleg Verych wrote:
> 
> I actually contacted Herbert back in summer. He told me, that he will
> take a look. But obviusly (including BTS's bugs) he have no time for
> dash.

Sorry, I've been travelling a lot since July so your email
is still in my backlog.

> I did rewrite of `test` built-in. Now i have 50% size deduction, but
> this is without "-o", "-a" things, that POSIX already dismissed. I
> just tried to address `!' and `(' as first parameters problem. This is
> also a very-very old problems of all shells, as far as i can see in
> historic records. Managed to do a rewrite :)
> 
> I'll finish by adding "-a" and "-o" by recurcive handling later.

Sounds good.

> Permission checks currently done by stat() plus some kind of uid/gid
> checks from bash.
> 
> I propose to use euidaccess(), because it have all credentials checks
> in the kernel (including SELinux, capabilities, file systems, etc.)
> I just saw BR in bash, but then the same copy/paste stuff in `test`.

As long as euidaccess does the right thing for root/execute
then this should be fine.

> In case if it is not exising in Hurd or BSD, then access() can be
> used, because `dash` is not SUID anyway.

Actually access(2) doesn't do the right thing but it should
be easy enough to use the existing code if euidaccess doesn't
exist.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#429251: [PATCH] honor tab as IFS whitespace when splitting fields

2007-09-19 Thread Herbert Xu
On Wed, Sep 19, 2007 at 09:29:25AM +, Gerrit Pape wrote:
> When trying to split fields by tabs, dash doesn't honour multiple tabs
> between fields as whitespace (at least that's how I interpret [1],
> please correct me if I'm wrong).
> 
> [1]: 
> http://www.opengroup.org/onlinepubs/95399/utilities/xcu_chap02.html#tag_02_06_05
> 
> Patch is from Stefan Potyra <[EMAIL PROTECTED]>, posted through
>  http://bugs.debian.org/429251

Yes this is a bug.  However the fix isn't quite right.  The
logic in ifsbreakup should be right so it'd be nice if we
could share code with it.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#431320: [EMAIL PROTECTED]: Bug#431320: dash, test: Arithmetic argument NULL must be handled as Not A Number]

2007-09-19 Thread Herbert Xu
On Wed, Sep 19, 2007 at 09:36:12AM +, Gerrit Pape wrote:
> Hi Herbert, all these three patches from Oleg at
>  http://bugs.debian.org/431320
> make sense to me, for the 3rd one I did a commit for the Debian package,
> attached.

I like this a lot.  Thanks for forwarding this Gerrit.

I'll merge this soon.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#334182: dash POSIX issues [Gentoo Bug #171630]

2007-05-20 Thread Herbert Xu
On Sun, May 20, 2007 at 04:56:33PM -0400, Chet Ramey wrote:
> 
> Kevin's analysis seems correct to me.  The bash behavior, modulo
> any (just-corrected) bugs, should reflect that interpretation.  I'm not
> sure how an alternate interpretation can be rationalized.

Well I respect your opinion but I have not been convinced that your
interpretation is the only correct one.

If you guys really care about this, please bring it to the attention
of the Austin group so that it can be clarified.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



Bug#334182: dash POSIX issues [Gentoo Bug #171630]

2007-05-20 Thread Herbert Xu
On Sun, May 20, 2007 at 01:11:02PM +0200, Kevin F. Quinn wrote:
> 
> (I think you meant:
> 
>   bash -c 'x=${K:=dvb0.net0} A=${K#dvb} env' | grep ^A=
>   bash -c 'K=dvb0.net0 A=${K#dvb} env' | grep ^A=
> )

Yep.

> Although that second fails when written like that (bash 3.2.15(1)), it
> does work interactively and in a script, so that's a bug in the bash
> command line processing, I'd guess.
> 
> 
> #!/bin/bash
> unset A K
> K=dvb0.net0 A=${K#dvb} eval echo \$A
> unset A K
> x=${K:=dvb0.net0} A=${K#dvb} echo $A
> unset A K
> K=dvb0.net0 A=${K#dvb} env | grep ^A=
> unset A K
> x=${K:=dvb0.net0} A=${K#dvb} env | grep ^A=
> 

Actually this is different.  Note that you're using a pipeline here
while I didn't have a pipeline within bash.  Indeed if you put the
pipeline inside bash then it works on the command line too:

bash -c 'K=dvb0.net0 A=${K#dvb} env | grep ^A='

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <[EMAIL PROTECTED]>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]



  1   2   >