From caixianchao at cn.fujitsu.com Wed Mar 5 06:32:23 2008 From: caixianchao at cn.fujitsu.com (Cai Xianchao) Date: Wed, 05 Mar 2008 12:32:23 +0800 Subject: [PATCH]It should not be allowed if environment variable begins with a digit Message-ID: <47CE2257.2050606@cn.fujitsu.com> hi, all 'environment variable begins with a digit' should not be allowed in tcsh, it is not allowed in both bash and ksh. Shell variable cann't begin with a digit too. version?tcsh-6.15.00 Signed-off-by: Cai Xianchao diff --git a/sh.func.c b/sh.func.c index 92e2447..9f08dc4 100644 --- a/sh.func.c +++ b/sh.func.c @@ -1239,6 +1239,8 @@ dosetenv(Char **v, struct command *c) } vp = *v++; + if (!letter(*vp)) + stderror(ERR_NAME | ERR_VARBEGIN); lp = vp; From lizf at cn.fujitsu.com Wed Mar 5 06:50:14 2008 From: lizf at cn.fujitsu.com (Li Zefan) Date: Wed, 05 Mar 2008 13:50:14 +0900 Subject: [Spam-fortigate] [PATCH]It should not be allowed if environment variable begins with a digit In-Reply-To: <47CE2257.2050606@cn.fujitsu.com> References: <47CE2257.2050606@cn.fujitsu.com> Message-ID: <47CE2686.7080804@cn.fujitsu.com> Cai Xianchao wrote: > hi, all > > 'environment variable begins with a digit' should not be allowed in tcsh, > it is not allowed in both bash and ksh. Shell variable cann't begin with > a digit too. > > The patch is obviously wrong. You are disallowing variables that don't begin with a letter. And why can't an env variable begins with a digit? It's not convincing Just because bash and ksh disallow it. Does it cause any problems in the real world? > version?tcsh-6.15.00 > > Signed-off-by: Cai Xianchao > > diff --git a/sh.func.c b/sh.func.c > index 92e2447..9f08dc4 100644 > --- a/sh.func.c > +++ b/sh.func.c > @@ -1239,6 +1239,8 @@ dosetenv(Char **v, struct command *c) > } > > vp = *v++; > + if (!letter(*vp)) > + stderror(ERR_NAME | ERR_VARBEGIN); > > lp = vp; > > _______________________________________________ > Tcsh mailing list > Tcsh at mx.gw.com > http://mx.gw.com/mailman/listinfo/tcsh > From lizf at cn.fujitsu.com Wed Mar 5 07:06:36 2008 From: lizf at cn.fujitsu.com (Li Zefan) Date: Wed, 05 Mar 2008 14:06:36 +0900 Subject: [Spam-fortigate] Re: [Spam-fortigate] [PATCH]It should not be allowed if environment variable begins with a digit In-Reply-To: <47CE2686.7080804@cn.fujitsu.com> References: <47CE2257.2050606@cn.fujitsu.com> <47CE2686.7080804@cn.fujitsu.com> Message-ID: <47CE2A5C.9050902@cn.fujitsu.com> Li Zefan ??: > Cai Xianchao wrote: > >> hi, all >> >> 'environment variable begins with a digit' should not be allowed in tcsh, >> it is not allowed in both bash and ksh. Shell variable cann't begin with >> a digit too. >> >> >> > > The patch is obviously wrong. You are disallowing variables that don't > begin with > a letter. > > And why can't an env variable begins with a digit? It's not convincing Just > because bash and ksh disallow it. Does it cause any problems in the real > world? > > Is this a compatibility break to add this restriction to env variable? >> version?tcsh-6.15.00 >> >> Signed-off-by: Cai Xianchao >> >> diff --git a/sh.func.c b/sh.func.c >> index 92e2447..9f08dc4 100644 >> --- a/sh.func.c >> +++ b/sh.func.c >> @@ -1239,6 +1239,8 @@ dosetenv(Char **v, struct command *c) >> } >> >> vp = *v++; >> + if (!letter(*vp)) >> + stderror(ERR_NAME | ERR_VARBEGIN); >> >> lp = vp; >> >> _______________________________________________ >> Tcsh mailing list >> Tcsh at mx.gw.com >> http://mx.gw.com/mailman/listinfo/tcsh >> >> > > _______________________________________________ > Tcsh mailing list > Tcsh at mx.gw.com > http://mx.gw.com/mailman/listinfo/tcsh > From caixianchao at cn.fujitsu.com Wed Mar 5 07:32:24 2008 From: caixianchao at cn.fujitsu.com (Cai Xianchao) Date: Wed, 05 Mar 2008 13:32:24 +0800 Subject: [Spam-fortigate] [PATCH]It should not be allowed if environment variable begins with a digit In-Reply-To: <47CE2686.7080804@cn.fujitsu.com> References: <47CE2257.2050606@cn.fujitsu.com> <47CE2686.7080804@cn.fujitsu.com> Message-ID: <47CE3068.4080002@cn.fujitsu.com> Li Zefan ??: > Cai Xianchao wrote: >> hi, all >> >> 'environment variable begins with a digit' should not be allowed in >> tcsh, >> it is not allowed in both bash and ksh. Shell variable cann't begin >> with >> a digit too. >> >> > > The patch is obviously wrong. You are disallowing variables that don't > begin with > a letter. > > And why can't an env variable begins with a digit? It's not convincing > Just > because bash and ksh disallow it. Does it cause any problems in the real > world? The problem is that env variable cann't be echoed correctly if it begins with a digit. For example: [test at RHEL-5 ~]$ setenv 1t a [test at RHEL-5 ~]$ echo $1t t The result is not 'a' as I expected. The '$1' is parsed as $argv[1] while not the front part of the env variable '1t'. > >> version?tcsh-6.15.00 >> >> Signed-off-by: Cai Xianchao >> >> diff --git a/sh.func.c b/sh.func.c >> index 92e2447..9f08dc4 100644 >> --- a/sh.func.c >> +++ b/sh.func.c >> @@ -1239,6 +1239,8 @@ dosetenv(Char **v, struct command *c) >> } >> >> vp = *v++; >> + if (!letter(*vp)) >> + stderror(ERR_NAME | ERR_VARBEGIN); >> >> lp = vp; >> >> _______________________________________________ >> Tcsh mailing list >> Tcsh at mx.gw.com >> http://mx.gw.com/mailman/listinfo/tcsh >> > > > From vcrhonek at redhat.com Wed Mar 5 13:22:25 2008 From: vcrhonek at redhat.com (Vitezslav Crhonek) Date: Wed, 05 Mar 2008 12:22:25 +0100 Subject: tcsh man page fixes Message-ID: <47CE8271.40907@redhat.com> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, there are several Red Hat Bugzilla entries opened by Cai Xianchao against tcsh man pages. All issues are in latest upstream tcsh too, so I would like to discuss it here. 1) In the description of builtin "set", "The second form sets name to the null string" appears twice and the second is redundant. (https://bugzilla.redhat.com/show_bug.cgi?id=430459) diff --git a/tcsh.1 b/tcsh.1 - --- a/tcsh.1 +++ b/tcsh.1 @@ -3199,9 +3199,7 @@ specified, set only unique words keeping their order. ~ \-f prefers the first occurrence of a word, and \-l the last. ~ The fifth form sets the \fIindex\fR'th component of name to \fIword\fR; ~ this component must already exist. - -The sixth form lists only the names of all shell variables that are read-only. - -The seventh form makes \fIname\fR read-only, whether or not it has a value. - -The second form sets \fIname\fR to the null string. +The sixth form lists only the names of all shell variables that are read-only. The seventh form makes \fIname\fR read-only, whether or not it has a value. ~ The eighth form is the same as the third form, but ~ make \fIname\fR read-only at the same time. It's true and should be fixed. 2) There is no influence to run a set-user ID script whether or not option "-b" is used. (https://bugzilla.redhat.com/show_bug.cgi?id=433908) diff --git a/tcsh.man b/tcsh.man index 0c9c3b6..75fb6d1 100644 - --- a/tcsh.man +++ b/tcsh.man @@ -108,8 +108,7 @@ The rest of the flag arguments are interpreted as follows: ~ Forces a ``break'' from option processing, causing any ~ further shell arguments to be treated as non-option arguments. The remaining ~ arguments will not be interpreted as shell options. This may be used to pass - -options to a shell script without confusion or possible subterfuge. The shell - -will not run a set-user ID script without this option. +options to a shell script without confusion or possible subterfuge. ~ .TP 4 ~ .B \-c ~ Commands are read from the following argument (which must be present, and There's no influence of "-b" I can see, so again, I think it should be fixed. 3) ", and must be a single argument" should be deleted (https://bugzilla.redhat.com/show_bug.cgi?id=433914) diff --git a/tcsh.man b/tcsh.man index 0c9c3b6..b171aad 100644 - --- a/tcsh.man +++ b/tcsh.man @@ -112,8 +112,7 @@ options to a shell script without confusion or possible subterfuge. The shell ~ will not run a set-user ID script without this option. ~ .TP 4 ~ .B \-c - -Commands are read from the following argument (which must be present, and - -must be a single argument), +Commands are read from the following argument (which must be present), ~ stored in the \fBcommand\fR shell variable for reference, and executed. ~ Any remaining arguments are placed in the \fBargv\fR shell variable. ~ .TP 4 I know there was a discuss about this here, but not about man pages. I disagree with Cai and I think the statement in the man page is correct. You can see out arguments on RH Bugzilla. 4) '\' can not be used to quote all delimiters diff --git a/tcsh.man b/tcsh.man index 0c9c3b6..3e389f4 100644 - --- a/tcsh.man +++ b/tcsh.man @@ -1035,7 +1035,7 @@ Substitute \fIl\fR for \fIr\fR. ~ \fIl\fR is simply a string like \fIr\fR, not a regular expression as in ~ the eponymous \fIed\fR(1) command. ~ Any character may be used as the delimiter in place of `/'; - -a `\\' can be used to quote the delimiter inside \fIl\fR and \fIr\fR. +a `\\' can be used to quote the delimiter expect `(', `)', `|' and `>' inside \fIl\fR and \fIr\fR. ~ The character `&' in the \fIr\fR is replaced by \fIl\fR; `\\' also quotes `&'. ~ If \fIl\fR is empty (``''), the \fIl\fR from a previous substitution or the ~ \fIs\fR from a previous search or event number in event specification is used. I'm not sure how this exactly works... Sorry for longer post, but I won't fix it in Fedora/RHEL before it's commited in upstream. All patches come from Cai. Best regards, Vitezslav Crhonek -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org iD8DBQFHzoJws1VJEvNweZcRAniqAJ9X67KaUJO0SfzU4w6LbotlDzQcPwCdEoYv 8/5re0Pq6fLR0Fg9nqLrD1g= =NkJk -----END PGP SIGNATURE----- From caixianchao at cn.fujitsu.com Tue Mar 11 09:40:36 2008 From: caixianchao at cn.fujitsu.com (Cai Xianchao) Date: Tue, 11 Mar 2008 15:40:36 +0800 Subject: [PATCH] '$number' should be equivalent to '$argv[number]' when number is out of range Message-ID: <47D63774.5030702@cn.fujitsu.com> hi,all The manpage says that "$number Equivalent to ?$argv[number]?". They are indeed the same if "num" is not larger than the number of argument, but not if it is out of range, An error message should output in '$number' as '$argv[number]'. (package: tcsh-6.15.00) I did it as follows: [test at localhost ~]$ cat argv_num.tcsh #!/bin/tcsh echo $argv[1] [test at localhost ~]$ cat num.tcsh #!/bin/tcsh echo $1 [test at localhost ~]$ tcsh argv_num.tcsh argv: Subscript out of range. [test at localhost ~]$ tcsh num.tcsh Signed-off-by: Cai Xianchao diff --git a/sh.dol.c b/sh.dol.c index 73ac3b2..40c228a 100644 --- a/sh.dol.c +++ b/sh.dol.c @@ -507,9 +507,11 @@ Dgetdol(void) subscr = subscr * 10 + c - '0'; c = DgetC(0); } while (c != DEOF && Isdigit(c)); - unDredc(c); - if (subscr < 0) + vp = adrof(STRargv); + pb = blklen(vp->vec); + if (subscr < 0 || subscr > upb) stderror(ERR_RANGE); + unDredc(c); if (subscr == 0) { if (bitset) { dolp = dolzero ? STR1 : STR0; @@ -535,7 +537,6 @@ Dgetdol(void) if (length) stderror(ERR_NOTALLOWED, "$%"); #endif - vp = adrof(STRargv); if (vp == 0) { vp = &nulargv; cleanup_until(&name); From karim.hamidou at reseau.eseo.fr Tue Mar 18 18:34:02 2008 From: karim.hamidou at reseau.eseo.fr (karim.hamidou at reseau.eseo.fr) Date: Tue, 18 Mar 2008 17:34:02 +0100 (CET) Subject: A TOUR file for tcsh Message-ID: <45459.194.254.136.2.1205858042.squirrel@webmail.reseau.eseo.fr> Hi, I remember that there was in the ash distribution a file named TOUR which introduced the various data structures of the shell. Do you think it would be a good idea to write a TOUR file fot tcsh ? Regards, Karim Hamidou From christos at zoulas.com Tue Mar 18 19:32:49 2008 From: christos at zoulas.com (Christos Zoulas) Date: Tue, 18 Mar 2008 13:32:49 -0400 Subject: A TOUR file for tcsh In-Reply-To: <45459.194.254.136.2.1205858042.squirrel@webmail.reseau.eseo.fr> from karim.hamidou@reseau.eseo.fr (Mar 18, 5:34pm) Message-ID: <20080318173249.5621256539@rebar.astron.com> On Mar 18, 5:34pm, karim.hamidou at reseau.eseo.fr (karim.hamidou at reseau.eseo.fr) wrote: -- Subject: A TOUR file for tcsh | Hi, | | I remember that there was in the ash distribution a file named TOUR which | introduced the various data structures of the shell. | | Do you think it would be a good idea to write a TOUR file fot tcsh ? | Are there many people who want to understand and change the tcsh source code? christos From ldarby at tuffmail.com Tue Mar 18 20:29:10 2008 From: ldarby at tuffmail.com (Laurence Darby) Date: Tue, 18 Mar 2008 18:29:10 +0000 Subject: A TOUR file for tcsh In-Reply-To: <20080318173249.5621256539@rebar.astron.com> References: <45459.194.254.136.2.1205858042.squirrel@webmail.reseau.eseo.fr> <20080318173249.5621256539@rebar.astron.com> Message-ID: <20080318182910.0624afbd.ldarby@tuffmail.com> Christos Zoulas wrote: > On Mar 18, 5:34pm, karim.hamidou at reseau.eseo.fr > (karim.hamidou at reseau.eseo.fr) wrote: > -- Subject: A TOUR file for tcsh > > | Hi, > | > | I remember that there was in the ash distribution a file named TOUR > | which introduced the various data structures of the shell. > | > | Do you think it would be a good idea to write a TOUR file fot tcsh ? > | > > Are there many people who want to understand and change the tcsh > source code? A TOUR file certainly would have helped me when I started on this: http://bugs.gw.com/view.php?id=48 but I seemed to manage without one... Btw, is there any chance that can be merged in? Thanks, Laurence From karim.hamidou at reseau.eseo.fr Wed Mar 19 14:04:06 2008 From: karim.hamidou at reseau.eseo.fr (karim.hamidou at reseau.eseo.fr) Date: Wed, 19 Mar 2008 13:04:06 +0100 (CET) Subject: A TOUR file for tcsh In-Reply-To: <20080318173249.5621256539@rebar.astron.com> References: <45459.194.254.136.2.1205858042.squirrel@webmail.reseau.eseo.fr> from karim.hamidou@reseau.eseo.fr (Mar 18, 5:34pm) <20080318173249.5621256539@rebar.astron.com> Message-ID: <51982.194.254.136.2.1205928246.squirrel@webmail.reseau.eseo.fr> > Are there many people who want to understand and change the tcsh source > code? > > christos > Hi, I was thinking that it may help hackers who would like to add a ponctual functionnality to tcsh.