Patch Name: PHCO_27819 Patch Description: s700_800 10.20 csh(1) cumulative patch Creation Date: 02/11/14 Post Date: 02/11/27 Hardware Platforms - OS Releases: s700: 10.20 s800: 10.20 Products: N/A Filesets: OS-Core.CMDS-MIN Automatic Reboot?: No Status: General Release Critical: No Path Name: /hp-ux_patches/s700_800/10.X/PHCO_27819 Symptoms: PHCO_27819: 1. When multibyte characters, which are got as a result of evaluating an expression using `` (backquotes) are passed to csh(1), it gives an error message "backeval(1): Invalid multibyte character" intermittently. 2. Read from the pipe fails in csh(1) scripts when SIGWINCH is sent to it. 3. csh(1) misbehaves when the file system is full. PHCO_19434: 1. csh does not sort globbed output when using multi-byte NLS. 2. csh file globbing does not find >2Gb file. 3. csh file enquiries like if ( -f filename ) fail for large (>=2GB) files. 4. csh does not handle pwd correctly on LOFS (Loopback File System) mount. 5. csh doesn't handle SIGWINCH well. 6. Pattern match fails in case statement. PHCO_17187: 1. Setting LC_ALL to some locale has no effect on the messages being displayed. 2. csh(1) does not handle file name globbing correctly. 3. csh(1) does not handle '\0' character in backtick substitution. 4. csh(1) does not interpret the left shift operator when it is given in the if-then-else statements. 5. csh(1) doesn't compare multibyte characters correctly in utf8. PHCO_13632: 1. csh(1) exits with error message "Out of memory" while running large-scripts. PHCO_12721: 1. csh(1) is not able to expand wildcard characters when it's used with quote characters. For example, ls "/bin"/* in csh gives /bin/: not found eventhough the directory /bin/ exists in a system. 2. csh(1) does not echo ^A (control-A) character. PHCO_12010: 1. No special meaning should be given for \\ in the heredoc. 2. Changed MAXPATH to 4K to support PATH variable of size 4k. PHCO_10908: 1. The character '\' also escapes non-special characters. PHCO_9878: 1. csh prompts the error 'display_char(1): Invalid multibyte character' when -x option is enabled in multi-byte locales. 2. csh outputs the char '\' when it is used to escape the character which follows it. PHCO_9329: 1. csh adds the character '01' in the output when using :q modifier. PHCO_9199: 1. csh core dumps when using :q on a string contains both single and double quotes. PHCO_8630: 1. A "\n" was not being interpreted by the builtin command echo if it is combined with command-substitution. 2. The PATH variable size has been increased to 4K. PHCO_8333: 1. The value set to the shell variables 'term', 'user' and 'home' does not assign to the environment variables 'TERM', 'USER' and 'HOME'. 2. A newline in the sequence '\\n' is ignored if it's placed within double quotes. 3. csh hangs when applying :r modifier on a variable whose value does not contain .suffix. Defect Description: PHCO_27819: 1.When multibyte characters, which are got as a result of evaluating an expression using `` (backquotes) are passed to csh(1), it gives an error message "backeval(1): Invalid multibyte character" intermittently. One can re-produce the problem as follows : $ cat multibyte.c #include main() { int i, j; unsigned char buf[10], ch; strcpy(buf, "?"); for (i=0; i<10; i++) { for (j=0; j<4; j++) write(1, &(buf[j]), 1); } ch = '\n'; write(1, &ch, 1); } $ cc multibyte.c -o multibyte $ export LANG=ja_JP.SJIS $ cat xxx.csh #!/usr/bin/csh set variable = `echo "?" ` echo $variable set variable = `./multibyte` echo $variable $ ./xxx.csh ? backeval(1): Invalid multibyte character. Resolution : When reading through pipes, sometimes, all the characters of a multi-byte may not be read immediately by the process and there will be a delay in receiving few characters of a multi-byte. This was resulting in an incomplete read and when the characters returned through pipes did not form a valid multi-byte(some characters still arriving), csh(1) was returning "invalid multi-byte" character. To address this problem, the process which reads the data through pipe, will read the pipe multiple times(instead of previous one time) and it is assumed that all the data will have arrived by the time a second read of the pipe is done. Even after reading multiple times, if there is no data and the data obtained from earlier results in an invalid multibyte, csh(1) continues to report the error message. 2. Read from the pipe fails in csh(1) scripts when SIGWINCH is sent to it. When the csh(1) received a SIGWINCH while reading using the read(2) system call , it handled the signal, but failed to restart the read(2), which returned with no bytes read.Since the errno wasn't checked for EINTR, csh(1) erroneously assumed to have received an EOF from the pipe, and prematurely closes the pipe thus resulting in SIGPIPE. Resolution: Problem is fixed by registering signal handler for SIGWINCH using sigaction(3C) with SA_RESTART flag instead of signal(3C). This will make sure to restart any call that was interrupted due to SIGWINCH. Since read(2) gets restarted, data is read from the pipe completely, avoiding SIGPIPE. Also return value as well as error codes for read(2) are checked. 3. csh(1) misbehaves when the file system is full. Resolution: Problem has been fixed. PHCO_19434: 1. In multi-byte NLS environment, for example LANG=ja_JP.SJIS and LANG=ja_JP.eucJP, csh(1) is not sorting the globbed output correctly. 2. csh(1) is not handling the wildcard characters for large files(>2GB). For example : ls */sparse, where "sparse" is a large file displays "sparse not found". 3. The execution of "if (-f filename)" fails in a csh script, if "filename" is a large file(>=2GB). 4. In a loopback file system (LOFS), the 'pwd' command returns with "no such file or directory" in csh(1). 5. csh(1) does not handle "SIGWINCH" properly . It gives a Bus error(core dumped) or Signal 16. 6. Pattern matching fails because csh(1) compares the wchar_t value of the characters and is not considering the collation sequence. Resolution: 1. This problem was due to {} mismatch. Adding the {} braces at appropriate places solves the problem. 2. The system call "stat" was failing for >2GB files. So, replacing the stat call with stat64 call solves the problem. 3. The system call "stat" was failing for >2GB files. So, replacing the stat call with stat64 call solves the problem. 4. Changing the local function call, getworkdir() to libc call,getcwd() solves the problem. 5. The problem was that csh(1) was not blocking the signal SIGWINCH in certain critical regions of code like vfork(). So holding and releasing SIGWINCH at appropriate places solves the problem. 6. csh(1) has been changed so that it now calls strcoll() to compare characters. The strcoll() looks for the collation order of the characters and not its wchar_t values. PHCO_17187: 1. csh(1) doesn't call setlocale() when setting LC_ALL , this results in messages not being displayed properly. 2. csh(1) was not handling NULL characters properly ,which caused incorrect filename globbing . 3. Due to inappropriate handling of NULLS, csh(1) gave errors in backtick substitution. 4. csh(1) wrongly incorporates bit shift operators(<<) as here-document when the operator(<<) is not used in if-then-else. 5. csh(1) doesn't handle comparison of multibyte characters. This results in bad filename pattern match in utf8. PHCO_13632: 1. csh is dying and gives error message "out of memory" when it encounters very large pathnames. PHCO_12721: 1. csh does not handle quoted strings and wildcard "*". 2. csh does not echo ^A (Control-A) character. PHCO_12010: 1. No special meaning should be given for \\ in the heredoc. 2. Changed MAXPATH to 4K to support PATH variable of size 4k. PHCO_10908: 1. Patch PHCO_9878 breaks here-doc quoting PHCO_9878: 1. csh -x on LANG=ja_JP.SJIS cannot echo command line with multibyte char. 2. csh outputs \'value\' instead of 'value' in 10.10. PHCO_9329: 1. csh :q inserts '01' in the output. PHCO_9199: 1. 10.10 csh dump core when using :q modifier. PHCO_8630: 1. A "\n" was not being interpreted by the builtin command echo if it is combined with command-substitution. 2. The PATH variable size has been increased to 4K. PHCO_8333: 1. In 10.10 term, user and home are no longer automatically exports their values to the environment variable TERM, USER and HOME. 2. The char '\' does not escape a newline character within double quotes. 3. csh hangs when using :r qualifier; %set a = test ; echo $a:r loops for ever. SR: 8606105829 8606114866 8606242998 1653308668 1653257584 1653205583 8606100262 1653308023 4701418301 1653295451 8606102437 5003438903 1653276535 1653255398 1653258566 1653241323 4701374884 5003392464 1653230813 4701351320 1653198580 5003339564 4701341271 1653187617 1653180968 5003335133 1653214916 Patch Files: /usr/bin/csh what(1) Output: /usr/bin/csh: $Revision: 78.10.1.37 $ PATCH_10_20: alloc.o getwd.o jobs.o pprintf.o sh.dir .o sh.dol.o sh.err.o sh.exec.o sh.exp.o sh.f unc.o sh.glob.o sh.hist.o sh.init.o sh.lex.o sh.misc.o sh.o sh.parse.o sh.print.o sh.pro c.o sh.sem.o sh.set.o sh.time.o tenex.o hpux _rel.o 02/11/14 cksum(1) Output: 1270583367 155648 /usr/bin/csh Patch Conflicts: None Patch Dependencies: None Hardware Dependencies: None Other Dependencies: None Supersedes: PHCO_8333 PHCO_8630 PHCO_9199 PHCO_9329 PHCO_9878 PHCO_10908 PHCO_12010 PHCO_12721 PHCO_13632 PHCO_17187 PHCO_19434 Equivalent Patches: PHCO_27763: s700: 11.00 s800: 11.00 Patch Package Size: 210 KBytes Installation Instructions: Please review all instructions and the Hewlett-Packard SupportLine User Guide or your Hewlett-Packard support terms and conditions for precautions, scope of license, restrictions, and, limitation of liability and warranties, before installing this patch. ------------------------------------------------------------ 1. Back up your system before installing a patch. 2. Login as root. 3. Copy the patch to the /tmp directory. 4. Move to the /tmp directory and unshar the patch: cd /tmp sh PHCO_27819 5a. For a standalone system, run swinstall to install the patch: swinstall -x autoreboot=true -x match_target=true \ -s /tmp/PHCO_27819.depot By default swinstall will archive the original software in /var/adm/sw/patch/PHCO_27819. If you do not wish to retain a copy of the original software, you can create an empty file named /var/adm/sw/patch/PATCH_NOSAVE. WARNING: If this file exists when a patch is installed, the patch cannot be deinstalled. Please be careful when using this feature. It is recommended that you move the PHCO_27819.text file to /var/adm/sw/patch for future reference. To put this patch on a magnetic tape and install from the tape drive, use the command: dd if=/tmp/PHCO_27819.depot of=/dev/rmt/0m bs=2k Special Installation Instructions: None