Bug 61961
Summary: | Shell escape commands garbled | ||
---|---|---|---|
Product: | [Retired] Red Hat Public Beta | Reporter: | Klaus-J. Wolf <klaus-juergen.wolf> |
Component: | ncftp | Assignee: | Bernhard Rosenkraenzer <bero> |
Status: | CLOSED RAWHIDE | QA Contact: | Ben Levenson <benl> |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | skipjack-beta1 | CC: | bero, kjwolf |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2002-04-05 11:39:08 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: | |||
Bug Depends On: | |||
Bug Blocks: | 61901 |
Description
Klaus-J. Wolf
2002-03-26 10:02:32 UTC
This appears to be a stdio handling bug, since the following patch works around the problem: --- ncftp-3.1.3/ncftp/shell.c.foo Wed Mar 27 21:14:03 2002 +++ ncftp-3.1.3/ncftp/shell.c Wed Mar 27 21:15:23 2002 @@ -572,6 +572,7 @@ oldcount = gUserTypedSensitiveInfoAtShellSoDoNotSaveItToDisk; for (tUsed = 0;;) { (void) memset(&ai, 0, sizeof(ai)); + fflush(stdout); bUsed = MakeArgv(lineRead + tUsed, &ai.cargc, ai.cargv, (int) (sizeof(ai.cargv) / sizeof(char *)), ai.argbuf, sizeof(ai.argbuf), Adding this patch to ncftp to cure the symptoms for now. It is just a workaround, the bug is in ncftp. Using pointer to xclam local variable after the function containing it exited is really bad idea: --- shell.c.xx Wed Mar 27 11:34:58 2002 +++ shell.c Fri Apr 5 13:40:38 2002 @@ -225,13 +225,14 @@ MakeArgv(char *line, int *cargc, char ** char *dcp; char *scp; char *arg; - char xclam[4]; + char *xclam; *cargc = 0; scp = line; - dlim = dbuf + dbufsize - 1; + dlim = dbuf + dbufsize - 3; dcp = dbuf; + xclam = dlim + 1; xclam[0] = '!'; xclam[1] = '\0'; Either above patch, or, if nobody ever writes into *cargv[0], which would very surprise me, even better: --- shell.c.xx Wed Mar 27 11:34:58 2002 +++ shell.c Fri Apr 5 13:44:40 2002 @@ -225,16 +225,12 @@ MakeArgv(char *line, int *cargc, char ** char *dcp; char *scp; char *arg; - char xclam[4]; *cargc = 0; scp = line; dlim = dbuf + dbufsize - 1; dcp = dbuf; - xclam[0] = '!'; - xclam[1] = '\0'; - for (*cargc = 0; *cargc < cargcmax; ) { /* Eat preceding junk. */ for ( ; ; scp++) { @@ -260,7 +256,7 @@ MakeArgv(char *line, int *cargc, char ** if (scp[1] == '!') { scp[1] = '\0'; } else if ((scp[1] != '\0') && (!isspace((int) scp[1]))) { - cargv[0] = xclam; + cargv[0] = "!"; scp++; arg = dcp; cargv[*cargc] = arg; Both patches worked just fine for me. I have just built a 3.1.3-3 version with the second version of Jakub's proposal. cu, Florian La Roche |