Patch Name: PHCO_27138 Patch Description: s700_800 11.11 tail(1) cumulative patch Creation Date: 04/06/17 Post Date: 04/07/12 Hardware Platforms - OS Releases: s700: 11.11 s800: 11.11 Products: N/A Filesets: OS-Core.CMDS-MIN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP OS-Core.CMIN-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP Automatic Reboot?: No Status: General Release Critical: Yes PHCO_27138: HANG Category Tags: defect_repair enhancement general_release critical halts_system Path Name: /hp-ux_patches/s700_800/11.X/PHCO_27138 Symptoms: PHCO_27138: ( SR:8606346681 CR:JAGaf07505 ) tail(1) exits with error if the input file is a FIFO. ( SR:8606346696 CR:JAGaf07520 ) When the output of tail(1) is appended to the file specified as input, tail(1) hangs. PHCO_24707: ( SR:8606179218 CR:JAGad48442 ) tail(1) command does not display more than 20 kilo bytes relative to the end of file. Defect Description: PHCO_27138: ( SR:8606346681 CR:JAGaf07505 ) If the input file to tail(1) is a FIFO, tail(1) exits with an error message and non-zero exit status. For an input file, tail(1) tries to reach to a desired location using an api which is not supported for FIFO. Since this api was not able to reach to the desired location, tail(1) exited with error. Steps to reproduce the problem is as below: 1) Create a file (tfile) which has say 20 lines. 2) Create a FIFO by using the following command $ /usr/sbin/mknod ./fifo p 3) Write to the 'fifo' in background using cat(1) $ cat tfile > fifo & 4) The following command-lines will exit with error $ tail fifo tail: Cannot lseek to required position $ tail -n 10 fifo tail: Cannot lseek to required position In step 4, tail(1) exits with error and non-zero exit status. Resolution: A check is added to determine the type of the input file. If the input file is a FIFO, tail(1) will read the complete content of the FIFO and determines the lines to be written out. ( SR:8606346696 CR:JAGaf07520 ) When the output of tail(1) is appended to the input file, tail(1) hangs. This happens because tail(1) tries to write the output to the input file itself and which results in infinite write. Steps to reproduce the problem is as below: 1) Create a file 'tfile' with few line (20 lines). 2) The defect can be seen with following command lines: $ tail tfile >> tfile $ tail -n +10 tfile >> tfile This will write the output of the tail(1) back to tfile. There will be an infinite write to the input file. Resolution: Total number of bytes to be written out is calculated and after writing the required number of bytes, tail(1) will exit successfully. PHCO_24707: ( SR:8606179218 CR:JAGad48442 ) The number of line in the output of the tail(1) command is limited by the 20KB buffer size. For example: $ ll Filename -r--r--r-- 1 bsanjay uxdev 40098 Nov 1 17:37 Filename $ /usr/bin/tail -c 30000 Filename | wc -c 20480 $ cat Filename | /usr/bin/tail -c 30000 Filename | wc -c 20480 Resolution: The design of the tail(1) command is modified. The following are the new features available with this patch: - When the input is not a pipe, there is no limit on the output from tail(1). Even large files(>2GB) can be used as input to tail(1) command. In otherwords, all options to tail(-c, -n, -b) take a value greater than 2GB. For example: $ ll Filename -r--r--r-- 1 bsanjay uxdev 2150000001 Nov 1 17:37 Filename $ /usr/bin/tail -c 2150000000 Filename | wc -c 2150000000 - When the input to tail(1) is through a pipe, the new tail(1) command uses dynamically allocated buffers. Because of dynamic memory allocation, the output of tail(1) is limited to process limits. This limit is much higher than the old 20 KB limit. For example: $ ll Filename -r--r--r-- 1 bsanjay uxdev 2000000 Nov 1 17:37 Filename $ cat Filename | /usr/bin/tail -c 1000000 | wc -c 1000000 Note: If the output from the above example is less than the expected output, it is an indication that tail(1) is unable allocate more memory and the process limit is reached. Enhancement: No (superseded patches contained enhancements) PHCO_27138: Enhancements were delivered in a patch this one has superseded. Please review the Defect Description text for more information. SR: 8606179218 8606346681 8606346696 Patch Files: OS-Core.CMDS-MIN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: /usr/bin/tail /usr/lib/nls/msg/C/tail.cat OS-Core.CMIN-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: /usr/share/man/man1.Z/tail.1 what(1) Output: OS-Core.CMDS-MIN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: /usr/bin/tail: tail.c $Date: 2004/06/03 02:56:22 $Revision: r11.11/ 4 PATCH_11.11 (PHCO_27138) $Revision: vw: -f selectors: R11.11_BL2004_0617_2 PHCO_27138 'R11.11_BL2004_0617_2' /usr/lib/nls/msg/C/tail.cat: None OS-Core.CMIN-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: /usr/share/man/man1.Z/tail.1: None cksum(1) Output: OS-Core.CMDS-MIN,fr=B.11.11,fa=HP-UX_B.11.11_32/64,v=HP: 708683959 24576 /usr/bin/tail 1411521994 624 /usr/lib/nls/msg/C/tail.cat OS-Core.CMIN-ENG-A-MAN,fr=B.11.11,fa=HP-UX_B.11.11_32/64, v=HP: 1217510999 3253 /usr/share/man/man1.Z/tail.1 Patch Conflicts: None Patch Dependencies: None Hardware Dependencies: None Other Dependencies: None Supersedes: PHCO_24707 Equivalent Patches: None Patch Package Size: 50 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_27138 5. Run swinstall to install the patch: swinstall -x autoreboot=true -x patch_match_target=true \ -s /tmp/PHCO_27138.depot By default swinstall will archive the original software in /var/adm/sw/save/PHCO_27138. If you do not wish to retain a copy of the original software, include the patch_save_files option in the swinstall command above: -x patch_save_files=false WARNING: If patch_save_files is false when a patch is installed, the patch cannot be deinstalled. Please be careful when using this feature. For future reference, the contents of the PHCO_27138.text file is available in the product readme: swlist -l product -a readme -d @ /tmp/PHCO_27138.depot To put this patch on a magnetic tape and install from the tape drive, use the command: dd if=/tmp/PHCO_27138.depot of=/dev/rmt/0m bs=2k Special Installation Instructions: None