Message-Id: <199611190948.KAA22999@ion.lpr.e-technik.tu-muenchen.de>
Subject: pdksh: set -o ... +o destroys command line arguments
To: submit@bugs.debian.org (Debian BugSubmit)
Date: Tue, 19 Nov 1996 10:48:39 +0100 (MET)
X-Mailer: ELM [version 2.4 PL24 ME7a]
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
Package: pdksh
Version: 5.2.12-2
Setting multiple options with mixed +o and -o in one set command
destroys the command line arguments. at&t ksh works fine here.
The following shows this bug:
#!/bin/ksh
echo "Arguments before set -o .........: $*"
set -o allexport -o nolog
echo "Arguments after set -o ... -o ...: $*"
set +o allexport +o nolog
echo "Arguments after set +o ... +o ...: $*"
set -o allexport +o nolog
echo "Arguments after set -o ... +o ...: $*"
set +o allexport -o nolog
echo "Arguments after set +o ... -o ...: $*"
Regards
Herbert.
Forwarded to michael@cs.mun.ca;
Maintainer for pdksh is
Larry Daffner <vizzie@airmail.net>.
Message received at 5510-forwarded@bugs.debian.org:
Received: (at 5510-forwarded) by bugs.debian.org; 20 Nov 1996 20:21:59 +0000
Received: (qmail 2996 invoked from network); 20 Nov 1996 20:21:42 -0000
Received: from cartridge.i-connect.net (qmailr@206.139.73.12)
by master.debian.org with SMTP; 20 Nov 1996 20:21:42 -0000
Received: (qmail 7613 invoked from network); 20 Nov 1996 16:07:41 -0000
Received: from garfield.cs.mun.ca (root@134.153.1.1)
by cartridge.i-connect.net with SMTP; 20 Nov 1996 16:07:40 -0000
Received: from terra.cs.mun.ca (michael@terra.cs.mun.ca [134.153.1.6]) by garfield.cs.mun.ca (8.7.6/8.7.3) with ESMTP id MAA24552; Wed, 20 Nov 1996 12:36:03 -0330 (NST)
Received: (from michael@localhost) by terra.cs.mun.ca (8.7.6/8.7.3) id MAA21797; Wed, 20 Nov 1996 12:36:02 -0330 (NST)
Message-ID: <XFMail.961120123600.michael@cs.mun.ca>
X-Mailer: XFMail 0.4 [p0] on Unknown
Sender: michael@cs.mun.ca
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 8bit
MIME-Version: 1.0
In-Reply-To: <m0vQ6RS-0002g2C@pinky.mimosa.org>
Date: Wed, 20 Nov 1996 12:33:23 -0330 (NST)
Organization: Computer Science Dept., Memorial University of Newfoundland
From: Michael Rendell <michael@cs.mun.ca>
To: "Larry 'Daffy' Daffner" <vizzie@airmail.net>
Subject: RE: pdksh bug report - +o and -o in same set command fails
Cc: Herbert.Thielen@lpr.e-technik.tu-muenchen.de,
5510-forwarded@bugs.debian.org
Hi,
> Setting multiple options with mixed +o and -o in one set command
> destroys the command line arguments. at&t ksh works fine here.
The following patch (which will be in 5.2.13) fixes the problem:
*** pdksh-5.2.12/misc.c Tue Aug 20 14:24:14 1996
--- ./misc.c Wed Nov 20 12:11:47 1996
***************
*** 940,947 ****
* Used for 'typeset -LZ4'.
* - accepts +c as well as -c IF the GF_PLUSOPT flag is present. If an
* option starting with + is accepted, the GI_PLUS flag will be set
! * in go->info. Once a - or + has been seen, all other options must
! * start with the same character.
*/
int
ksh_getopt(argv, go, options)
--- 952,958 ----
* Used for 'typeset -LZ4'.
* - accepts +c as well as -c IF the GF_PLUSOPT flag is present. If an
* option starting with + is accepted, the GI_PLUS flag will be set
! * in go->info.
*/
int
ksh_getopt(argv, go, options)
***************
*** 952,957 ****
--- 963,969 ----
char c;
char *o;
+ go->info = 0;
if (go->p == 0 || (c = argv[go->optind - 1][go->p]) == '\0') {
char *arg = argv[go->optind], flag = arg ? *arg : '\0';
***************
*** 963,971 ****
return EOF;
}
if (arg == (char *) 0
! || ((flag != '-' || (go->info & GI_PLUS))
! && (!(go->flags & GF_PLUSOPT) || (go->info & GI_MINUS)
! || flag != '+'))
|| (c = arg[1]) == '\0')
{
go->p = 0;
--- 975,982 ----
return EOF;
}
if (arg == (char *) 0
! || ((flag != '-' ) /* neither a - nor a + (if + allowed) */
! && (!(go->flags & GF_PLUSOPT) || flag != '+'))
|| (c = arg[1]) == '\0')
{
go->p = 0;
Mike
Message received at 5510-forwarded@bugs.debian.org:
Received: (at 5510-forwarded) by bugs.debian.org; 20 Nov 1996 07:01:50 +0000
Received: (qmail 31882 invoked from network); 20 Nov 1996 07:01:48 -0000
Received: from mail.airmail.net (206.66.12.40)
by master.debian.org with SMTP; 20 Nov 1996 07:01:48 -0000
Received: from pinky.mimosa.org from [204.178.75.30] by mail.airmail.net
(/\##/\ Smail3.1.30.16 #30.104) with esmtp
id <m0vQ6RT-000QbnC@mail.airmail.net>; Wed, 20 Nov 96 00:47:27 -0600 (CST)
Received: from airmail.net ([127.0.0.1]) by pinky.mimosa.org
with esmtp (ident vizzie using rfc1413) id m0vQ6RS-0002g2C
(Debian Smail-3.2 1996-Jul-4 #3); Wed, 20 Nov 1996 00:47:26 -0600 (CST)
Message-Id: <m0vQ6RS-0002g2C@pinky.mimosa.org>
To: michael@cs.mun.ca
cc: Herbert.Thielen@lpr.e-technik.tu-muenchen.de,
5510-forwarded@bugs.debian.org
Subject: pdksh bug report - +o and -o in same set command fails
Date: Wed, 20 Nov 1996 00:47:25 -0600
From: "Larry 'Daffy' Daffner" <vizzie@airmail.net>
Michael,
Here is a bug report on pdksh that I recieved. Please cc both myself
and 5510-forwarded@bugs.debian.org with any followup, so that further
information can be tracked in the Debian bug tracking system.
Thanks,
Larry
------- Forwarded Message
Date: Tue, 19 Nov 1996 10:48:39 +0100
From: Herbert Thielen <Herbert.Thielen@lpr.e-technik.tu-muenchen.de>
To: submit@bugs.debian.org (Debian BugSubmit)
Subject: Bug#5510: pdksh: set -o ... +o destroys command line arguments
Package: pdksh
Version: 5.2.12-2
Setting multiple options with mixed +o and -o in one set command
destroys the command line arguments. at&t ksh works fine here.
The following shows this bug:
#!/bin/ksh
echo "Arguments before set -o .........: $*"
set -o allexport -o nolog
echo "Arguments after set -o ... -o ...: $*"
set +o allexport +o nolog
echo "Arguments after set +o ... +o ...: $*"
set -o allexport +o nolog
echo "Arguments after set -o ... +o ...: $*"
set +o allexport -o nolog
echo "Arguments after set +o ... -o ...: $*"
Regards
Herbert.
------- End of Forwarded Message
Reply sent to "Larry 'Daffy' Daffner" <vizzie@airmail.net>:
You have marked bug as forwarded.
"Larry 'Daffy' Daffner" <vizzie@airmail.net>
Sorry, this message was lost when this bug report was restored from a backup.