From kst at mib.org Thu Jun 18 22:01:50 2009 From: kst at mib.org (Keith Thompson) Date: Thu, 18 Jun 2009 12:01:50 -0700 Subject: Ellipsis in "jobs" output Message-ID: <20090618190150.GA17236@nuthaus.mib.org> For background commands with long argument lists, the "jobs" command shows an ellipsis rather than the entire command string. For example: % echo $version tcsh 6.16.00 (Astron) 2008-09-30 (i486-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec % vi /home/username/subdirectory/another_subdirectory/this_is_an_absurdly_long_path_name_for_some_file.txt [ Type control-Z to suspend vi ] Suspended % jobs [1] + Suspended vi ... % I often have several suspended vi sessions for files with very long path names. When I want to bring one of the sessions back to the foreground, it's very hard to tell which session is which. Is there any way to force the "jobs" command to display the full command, without the ellipsis? I've studied the man page; there doesn't seem to be such an option. ("jobs -l" doesn't help; it just adds the process id to the listing.) I even looked through the tcsh sources. If I can find out where this is done, I'd be glad to modify the sources myself and build my own modified tcsh. -- Keith Thompson (The_Other_Keith) kst at mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" From christos at zoulas.com Fri Jun 19 19:17:18 2009 From: christos at zoulas.com (Christos Zoulas) Date: Fri, 19 Jun 2009 12:17:18 -0400 Subject: Ellipsis in "jobs" output In-Reply-To: <20090618190150.GA17236@nuthaus.mib.org> from Keith Thompson (Jun 18, 12:01pm) Message-ID: <20090619161719.0A53156550@rebar.astron.com> On Jun 18, 12:01pm, kst at mib.org (Keith Thompson) wrote: -- Subject: Ellipsis in "jobs" output | For background commands with long argument lists, the "jobs" command | shows an ellipsis rather than the entire command string. | | For example: | | % echo $version | tcsh 6.16.00 (Astron) 2008-09-30 (i486-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec | % vi /home/username/subdirectory/another_subdirectory/this_is_an_absurdly_long_path_name_for_some_file.txt | [ Type control-Z to suspend vi ] | Suspended | % jobs | [1] + Suspended vi ... | % | | I often have several suspended vi sessions for files with very long | path names. When I want to bring one of the sessions back to the | foreground, it's very hard to tell which session is which. | | Is there any way to force the "jobs" command to display the full | command, without the ellipsis? I've studied the man page; there | doesn't seem to be such an option. ("jobs -l" doesn't help; it just | adds the process id to the listing.) | | I even looked through the tcsh sources. If I can find out where this | is done, I'd be glad to modify the sources myself and build my own | modified tcsh. | | -- | Keith Thompson (The_Other_Keith) kst at mib.org | Nokia | "We must do something. This is something. Therefore, we must do this." | -- Antony Jay and Jonathan Lynn, "Yes Minister" I've committed this... christos Index: sh.proc.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/sh.proc.c,v retrieving revision 3.106 diff -u -u -r3.106 sh.proc.c --- sh.proc.c 12 Jul 2007 14:12:46 -0000 3.106 +++ sh.proc.c 19 Jun 2009 16:15:57 -0000 @@ -126,6 +126,7 @@ static void pflush (struct process *); static void pfree (struct process *); static void pclrcurr (struct process *); +static void morecommand (size_t); static void padd (struct command *); static int pprint (struct process *, int); static void ptprint (struct process *); @@ -670,21 +671,37 @@ } /* +4 here is 1 for '\0', 1 ea for << >& >> */ -static Char command[PMAXLEN + 4]; +static Char *cmdstr; +static size_t cmdmax; static size_t cmdlen; static Char *cmdp; +static void +morecommand(size_t s) +{ + Char *ncmdstr; + ptrdiff_t d; + + cmdmax += s; + ncmdstr = xrealloc(cmdstr, cmdmax); + d = ncmdstr - cmdstr; + cmdstr = ncmdstr; + cmdp += d; +} + /* GrP * unparse - Export padd() functionality */ Char * unparse(struct command *t) { - cmdp = command; + if (cmdmax == 0) + morecommand(1024); + cmdp = cmdstr; cmdlen = 0; padd(t); *cmdp++ = '\0'; - return Strsave(command); + return Strsave(cmdstr); } @@ -707,7 +724,9 @@ pp->p_flags |= PBACKQ; if (t->t_dflg & F_HUP) pp->p_flags |= PHUP; - cmdp = command; + if (cmdmax == 0) + morecommand(1024); + cmdp = cmdstr; cmdlen = 0; padd(t); *cmdp++ = 0; @@ -716,7 +735,7 @@ if (t->t_dflg & F_STDERR) pp->p_flags |= PDIAG; } - pp->p_command = Strsave(command); + pp->p_command = Strsave(cmdstr); if (pcurrjob) { struct process *fp; @@ -839,7 +858,7 @@ static void pads(Char *cp) { - size_t i; + size_t i, len; /* * Avoid the Quoted Space alias hack! Reported by: @@ -850,14 +869,9 @@ i = Strlen(cp); - if (cmdlen >= PMAXLEN) - return; - if (cmdlen + i >= PMAXLEN) { - (void) Strcpy(cmdp, STRsp3dots); - cmdlen = PMAXLEN; - cmdp += 4; - return; - } + len = cmdlen + i + 100; + if (len > cmdmax) + morecommand(len); (void) Strcpy(cmdp, cp); cmdp += i; cmdlen += i; Index: sh.proc.h =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/sh.proc.h,v retrieving revision 3.12 diff -u -u -r3.12 sh.proc.h --- sh.proc.h 12 Jan 2006 19:55:38 -0000 3.12 +++ sh.proc.h 19 Jun 2009 16:15:57 -0000 @@ -1,4 +1,4 @@ -/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.12 2006/01/12 19:55:38 christos Exp $ */ +/* $Header: /src/pub/tcsh/sh.proc.h,v 3.12 2006/01/12 19:55:38 christos Exp $ */ /* * sh.proc.h: Process data structures and variables */ @@ -77,7 +77,7 @@ # endif /* POSIX */ # endif /* _SEQUENT_ */ #endif /* BSDTIMES */ - Char *p_command; /* first PMAXLEN chars of command */ + Char *p_command; /* command */ }; /* flag values for p_flags */ @@ -103,8 +103,6 @@ #define PBACKQ (1<<16) /* Process is `` evaluation */ #define PHUP (1<<17) /* Process is marked for SIGHUP on exit */ -#define PMAXLEN 80 - /* defines for arguments to pprint */ #define NUMBER 01 #define NAME 02 Index: tc.const.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/tc.const.c,v retrieving revision 3.90 diff -u -u -r3.90 tc.const.c --- tc.const.c 17 Oct 2008 20:25:00 -0000 3.90 +++ tc.const.c 19 Jun 2009 16:15:57 -0000 @@ -326,7 +326,6 @@ Char STRspRarrow2[] = { ' ', '>', '>', '\0' }; Char STRspRarrow[] = { ' ', '>', '\0' }; Char STRgt[] = { '>', '\0' }; -Char STRsp3dots[] = { ' ', '.', '.', '.', '\0' }; Char STRcent2[] = { '%', '%', '\0' }; Char STRcentplus[] = { '%', '+', '\0' }; Char STRcentminus[] = { '%', '-', '\0' }; From christos at zoulas.com Fri Jun 19 19:32:43 2009 From: christos at zoulas.com (Christos Zoulas) Date: Fri, 19 Jun 2009 12:32:43 -0400 Subject: Ellipsis in "jobs" output In-Reply-To: <20090618190150.GA17236@nuthaus.mib.org> from Keith Thompson (Jun 18, 12:01pm) Message-ID: <20090619163243.BB27C5654E@rebar.astron.com> On Jun 18, 12:01pm, kst at mib.org (Keith Thompson) wrote: -- Subject: Ellipsis in "jobs" output | For background commands with long argument lists, the "jobs" command | shows an ellipsis rather than the entire command string. | | For example: | | % echo $version | tcsh 6.16.00 (Astron) 2008-09-30 (i486-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec | % vi /home/username/subdirectory/another_subdirectory/this_is_an_absurdly_long_path_name_for_some_file.txt | [ Type control-Z to suspend vi ] | Suspended | % jobs | [1] + Suspended vi ... | % | | I often have several suspended vi sessions for files with very long | path names. When I want to bring one of the sessions back to the | foreground, it's very hard to tell which session is which. | | Is there any way to force the "jobs" command to display the full | command, without the ellipsis? I've studied the man page; there | doesn't seem to be such an option. ("jobs -l" doesn't help; it just | adds the process id to the listing.) | | I even looked through the tcsh sources. If I can find out where this | is done, I'd be glad to modify the sources myself and build my own | modified tcsh. oops there was a bug before: Index: sh.proc.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/sh.proc.c,v retrieving revision 3.106 diff -u -u -r3.106 sh.proc.c --- sh.proc.c 12 Jul 2007 14:12:46 -0000 3.106 +++ sh.proc.c 19 Jun 2009 16:31:38 -0000 @@ -126,6 +126,7 @@ static void pflush (struct process *); static void pfree (struct process *); static void pclrcurr (struct process *); +static void morecommand (size_t); static void padd (struct command *); static int pprint (struct process *, int); static void ptprint (struct process *); @@ -670,21 +671,37 @@ } /* +4 here is 1 for '\0', 1 ea for << >& >> */ -static Char command[PMAXLEN + 4]; +static Char *cmdstr; +static size_t cmdmax; static size_t cmdlen; static Char *cmdp; +static void +morecommand(size_t s) +{ + Char *ncmdstr; + ptrdiff_t d; + + cmdmax += s; + ncmdstr = xrealloc(cmdstr, cmdmax); + d = ncmdstr - cmdstr; + cmdstr = ncmdstr; + cmdp += d; +} + /* GrP * unparse - Export padd() functionality */ Char * unparse(struct command *t) { - cmdp = command; + if (cmdmax == 0) + morecommand(1024); + cmdp = cmdstr; cmdlen = 0; padd(t); *cmdp++ = '\0'; - return Strsave(command); + return Strsave(cmdstr); } @@ -707,7 +724,9 @@ pp->p_flags |= PBACKQ; if (t->t_dflg & F_HUP) pp->p_flags |= PHUP; - cmdp = command; + if (cmdmax == 0) + morecommand(1024); + cmdp = cmdstr; cmdlen = 0; padd(t); *cmdp++ = 0; @@ -716,7 +735,7 @@ if (t->t_dflg & F_STDERR) pp->p_flags |= PDIAG; } - pp->p_command = Strsave(command); + pp->p_command = Strsave(cmdstr); if (pcurrjob) { struct process *fp; @@ -839,7 +858,7 @@ static void pads(Char *cp) { - size_t i; + size_t i, len; /* * Avoid the Quoted Space alias hack! Reported by: @@ -850,14 +869,9 @@ i = Strlen(cp); - if (cmdlen >= PMAXLEN) - return; - if (cmdlen + i >= PMAXLEN) { - (void) Strcpy(cmdp, STRsp3dots); - cmdlen = PMAXLEN; - cmdp += 4; - return; - } + len = cmdlen + i + 100; + if (len >= cmdmax) + morecommand(len); (void) Strcpy(cmdp, cp); cmdp += i; cmdlen += i; Index: sh.proc.h =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/sh.proc.h,v retrieving revision 3.12 diff -u -u -r3.12 sh.proc.h --- sh.proc.h 12 Jan 2006 19:55:38 -0000 3.12 +++ sh.proc.h 19 Jun 2009 16:31:38 -0000 @@ -1,4 +1,4 @@ -/* $Header: /p/tcsh/cvsroot/tcsh/sh.proc.h,v 3.12 2006/01/12 19:55:38 christos Exp $ */ +/* $Header: /src/pub/tcsh/sh.proc.h,v 3.12 2006/01/12 19:55:38 christos Exp $ */ /* * sh.proc.h: Process data structures and variables */ @@ -77,7 +77,7 @@ # endif /* POSIX */ # endif /* _SEQUENT_ */ #endif /* BSDTIMES */ - Char *p_command; /* first PMAXLEN chars of command */ + Char *p_command; /* command */ }; /* flag values for p_flags */ @@ -103,8 +103,6 @@ #define PBACKQ (1<<16) /* Process is `` evaluation */ #define PHUP (1<<17) /* Process is marked for SIGHUP on exit */ -#define PMAXLEN 80 - /* defines for arguments to pprint */ #define NUMBER 01 #define NAME 02 Index: tc.const.c =================================================================== RCS file: /p/tcsh/cvsroot/tcsh/tc.const.c,v retrieving revision 3.90 diff -u -u -r3.90 tc.const.c --- tc.const.c 17 Oct 2008 20:25:00 -0000 3.90 +++ tc.const.c 19 Jun 2009 16:31:38 -0000 @@ -326,7 +326,6 @@ Char STRspRarrow2[] = { ' ', '>', '>', '\0' }; Char STRspRarrow[] = { ' ', '>', '\0' }; Char STRgt[] = { '>', '\0' }; -Char STRsp3dots[] = { ' ', '.', '.', '.', '\0' }; Char STRcent2[] = { '%', '%', '\0' }; Char STRcentplus[] = { '%', '+', '\0' }; Char STRcentminus[] = { '%', '-', '\0' }; From kst at mib.org Tue Jun 23 02:53:15 2009 From: kst at mib.org (Keith Thompson) Date: Mon, 22 Jun 2009 16:53:15 -0700 Subject: Ellipsis in "jobs" output In-Reply-To: <20090619163243.BB27C5654E@rebar.astron.com> References: <20090618190150.GA17236@nuthaus.mib.org> <20090619163243.BB27C5654E@rebar.astron.com> Message-ID: <20090622235315.GA27634@nuthaus.mib.org> On Fri, Jun 19, 2009 at 12:32:43PM -0400, Christos Zoulas wrote: > On Jun 18, 12:01pm, kst at mib.org (Keith Thompson) wrote: > -- Subject: Ellipsis in "jobs" output > > | For background commands with long argument lists, the "jobs" command > | shows an ellipsis rather than the entire command string. > | > | For example: > | > | % echo $version > | tcsh 6.16.00 (Astron) 2008-09-30 (i486-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec > | % vi /home/username/subdirectory/another_subdirectory/this_is_an_absurdly_long_path_name_for_some_file.txt > | [ Type control-Z to suspend vi ] > | Suspended > | % jobs > | [1] + Suspended vi ... > | % > | > | I often have several suspended vi sessions for files with very long > | path names. When I want to bring one of the sessions back to the > | foreground, it's very hard to tell which session is which. > | > | Is there any way to force the "jobs" command to display the full > | command, without the ellipsis? I've studied the man page; there > | doesn't seem to be such an option. ("jobs -l" doesn't help; it just > | adds the process id to the listing.) > | > | I even looked through the tcsh sources. If I can find out where this > | is done, I'd be glad to modify the sources myself and build my own > | modified tcsh. > > oops there was a bug before: > [diffs deleted] I tried this on Ubuntu, and it seems to work (huzzah!). I tried it on Cygwin (which, unfortunately, is where I realliy need it), and I got: % ./tcsh-6.16.00-patched/tcsh.exe -l free(0x74d808) bad range check. (memtop = 0x74f000 membot = 0x730000) Abort (core dumped) Let me know if I can provide more information. -- Keith Thompson (The_Other_Keith) kst at mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" From christos at zoulas.com Tue Jun 23 15:48:19 2009 From: christos at zoulas.com (Christos Zoulas) Date: Tue, 23 Jun 2009 08:48:19 -0400 Subject: Ellipsis in "jobs" output In-Reply-To: <20090622235315.GA27634@nuthaus.mib.org> from Keith Thompson (Jun 22, 4:53pm) Message-ID: <20090623124819.AAE635654F@rebar.astron.com> On Jun 22, 4:53pm, kst at mib.org (Keith Thompson) wrote: -- Subject: Re: Ellipsis in "jobs" output | On Fri, Jun 19, 2009 at 12:32:43PM -0400, Christos Zoulas wrote: | > On Jun 18, 12:01pm, kst at mib.org (Keith Thompson) wrote: | > -- Subject: Ellipsis in "jobs" output | > | > | For background commands with long argument lists, the "jobs" command | > | shows an ellipsis rather than the entire command string. | > | | > | For example: | > | | > | % echo $version | > | tcsh 6.16.00 (Astron) 2008-09-30 (i486-intel-linux) options wide,nls,dl,al,kan,sm,rh,color,filec | > | % vi /home/username/subdirectory/another_subdirectory/this_is_an_absurdly_long_path_name_for_some_file.txt | > | [ Type control-Z to suspend vi ] | > | Suspended | > | % jobs | > | [1] + Suspended vi ... | > | % | > | | > | I often have several suspended vi sessions for files with very long | > | path names. When I want to bring one of the sessions back to the | > | foreground, it's very hard to tell which session is which. | > | | > | Is there any way to force the "jobs" command to display the full | > | command, without the ellipsis? I've studied the man page; there | > | doesn't seem to be such an option. ("jobs -l" doesn't help; it just | > | adds the process id to the listing.) | > | | > | I even looked through the tcsh sources. If I can find out where this | > | is done, I'd be glad to modify the sources myself and build my own | > | modified tcsh. | > | > oops there was a bug before: | > | [diffs deleted] | | I tried this on Ubuntu, and it seems to work (huzzah!). | | I tried it on Cygwin (which, unfortunately, is where I realliy need it), | and I got: | | % ./tcsh-6.16.00-patched/tcsh.exe -l | free(0x74d808) bad range check. (memtop = 0x74f000 membot = 0x730000) | Abort (core dumped) | | Let me know if I can provide more information. Was that with my first patch (which had an off by one check) or with the second one? christos From kst at mib.org Tue Jun 23 18:51:22 2009 From: kst at mib.org (Keith Thompson) Date: Tue, 23 Jun 2009 08:51:22 -0700 Subject: Ellipsis in "jobs" output In-Reply-To: <20090623124819.AAE635654F@rebar.astron.com> References: <20090622235315.GA27634@nuthaus.mib.org> <20090623124819.AAE635654F@rebar.astron.com> Message-ID: <20090623155122.GA21485@nuthaus.mib.org> On Tue, Jun 23, 2009 at 08:48:19AM -0400, Christos Zoulas wrote: > Date: Tue, 23 Jun 2009 08:48:19 -0400 > From: Christos Zoulas > To: Keith Thompson > Cc: tcsh-bugs at mx.gw.com > Subject: Re: Ellipsis in "jobs" output > X-Mailer: Mail User's Shell (7.2.6 beta(4.pl1)+dynamic 20000103) > > On Jun 22, 4:53pm, kst at mib.org (Keith Thompson) wrote: > -- Subject: Re: Ellipsis in "jobs" output [...] > | I tried this on Ubuntu, and it seems to work (huzzah!). > | > | I tried it on Cygwin (which, unfortunately, is where I realliy need it), > | and I got: > | > | % ./tcsh-6.16.00-patched/tcsh.exe -l > | free(0x74d808) bad range check. (memtop = 0x74f000 membot = 0x730000) > | Abort (core dumped) > | > | Let me know if I can provide more information. > > Was that with my first patch (which had an off by one check) or with the > second one? It was the second one (which I should have made clear in the first place). -- Keith Thompson (The_Other_Keith) kst at mib.org Nokia "We must do something. This is something. Therefore, we must do this." -- Antony Jay and Jonathan Lynn, "Yes Minister" From christos at zoulas.com Tue Jun 23 21:31:44 2009 From: christos at zoulas.com (Christos Zoulas) Date: Tue, 23 Jun 2009 14:31:44 -0400 Subject: Ellipsis in "jobs" output In-Reply-To: <20090623155122.GA21485@nuthaus.mib.org> from Keith Thompson (Jun 23, 8:51am) Message-ID: <20090623183144.BB0E75654E@rebar.astron.com> On Jun 23, 8:51am, kst at mib.org (Keith Thompson) wrote: -- Subject: Re: Ellipsis in "jobs" output | On Tue, Jun 23, 2009 at 08:48:19AM -0400, Christos Zoulas wrote: | > Date: Tue, 23 Jun 2009 08:48:19 -0400 | > From: Christos Zoulas | > To: Keith Thompson | > Cc: tcsh-bugs at mx.gw.com | > Subject: Re: Ellipsis in "jobs" output | > X-Mailer: Mail User's Shell (7.2.6 beta(4.pl1)+dynamic 20000103) | > | > On Jun 22, 4:53pm, kst at mib.org (Keith Thompson) wrote: | > -- Subject: Re: Ellipsis in "jobs" output | [...] | > | I tried this on Ubuntu, and it seems to work (huzzah!). | > | | > | I tried it on Cygwin (which, unfortunately, is where I realliy need it), | > | and I got: | > | | > | % ./tcsh-6.16.00-patched/tcsh.exe -l | > | free(0x74d808) bad range check. (memtop = 0x74f000 membot = 0x730000) | > | Abort (core dumped) | > | | > | Let me know if I can provide more information. | > | > Was that with my first patch (which had an off by one check) or with the | > second one? | | It was the second one (which I should have made clear in the first | place). Strange, it works for me (on cygwin). Does gdb give you a useful trace? version tcsh 6.16.00 (Astron) 2008-09-30 (i386-intel-cygwin) options 8b,nls,dl,al,kan,rh,color,dspm christos