Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-1915

glibc: iconv tool does not support in-place conversion of files

    • glibc-2.34-143.el9
    • None
    • Moderate
    • Hide
      422ed8ede312f786369e4850e47b8d32beaae4e4
      0cb64617a6f691b611406427c8e24b7f04c4983f
      00ba299787c2ea9e5c4986301e2f4965dffbfded
      6cbf845fcdc76131d0e674cee454fe738b69c69d
      8ef3cff9d1ceafe369f982d980678d749fb93bd2
      75819cdd29a193cc2db980878bec305905b22bbc
      fa1b0d5e9f6e0353e16339430770a7a8824c0468
      079ebf7624e7fd0ad7fe94a7176a2e132c996d86
      Show
      422ed8ede312f786369e4850e47b8d32beaae4e4 0cb64617a6f691b611406427c8e24b7f04c4983f 00ba299787c2ea9e5c4986301e2f4965dffbfded 6cbf845fcdc76131d0e674cee454fe738b69c69d 8ef3cff9d1ceafe369f982d980678d749fb93bd2 75819cdd29a193cc2db980878bec305905b22bbc fa1b0d5e9f6e0353e16339430770a7a8824c0468 079ebf7624e7fd0ad7fe94a7176a2e132c996d86
    • 2
    • rhel-sst-pt-libraries
    • ssg_platform_tools
    • 3
    • False
    • Yes
    • Red Hat Enterprise Linux
    • SST PT Libraries Sprint 11, SST PT Libraries Sprint 13
    • Requested
    • None
    • Bug Fix
    • Hide
      Cause (the user action or circumstances that trigger the bug): If the iconv program converts an input file to the same output file (specified using the -o option), it may truncate the file before processing is complete.
      Consequence (what the user experience is when the bug occurs): The in-place conversion of sufficiently large files is not successful, corrupting the file.
      Fix (what has changed to fix the bug; do not include overly technical details): The iconv program now automatically uses a temporary file if the input files and the output file overlap.
      Result (what happens now that the patch is applied): In-place conversions of files are now possible, similar to GNU recode.
      Show
      Cause (the user action or circumstances that trigger the bug): If the iconv program converts an input file to the same output file (specified using the -o option), it may truncate the file before processing is complete. Consequence (what the user experience is when the bug occurs): The in-place conversion of sufficiently large files is not successful, corrupting the file. Fix (what has changed to fix the bug; do not include overly technical details): The iconv program now automatically uses a temporary file if the input files and the output file overlap. Result (what happens now that the patch is applied): In-place conversions of files are now possible, similar to GNU recode.
    • Proposed
    • x86_64
    • None

      What were you trying to do that didn't work?

      Convert a file from ISO-8859-1 to UTF-8 

      Please provide the package NVR for which bug is seen:

      glibc-common-2.34-60.el9.x86_64

      How reproducible:

      in house and by customer

      Steps to reproduce

      Test environment:
      Release:          Red Hat Enterprise Linux release 9.2 (Plow)
      Kernel:           5.14.0-284.25.1.el9_2.x86_64
      IP Address:       10.1.183.219
      glibc-common:     glibc-common-2.34-60.el9.x86_64
      locale:           en.US.ISO-8859-1

      Below 32K:

      [root@test ~]# tr -dc '[:alnum:] \n' </dev/urandom | head -c 31000 > test.txt ; stat -c '%s' test.txt ; iconv -f ISO-8859-1 -t UTF-8 test.txt -o test.txt ; stat -c '%s' test.txt
      31000
      48258

      32K and above:

      [root@test ~]# tr -dc '[:alnum:] \n' </dev/urandom | head -c 32000 > test.txt ; stat -c '%s' test.txt ; iconv -f ISO-8859-1 -t UTF-8 test.txt -o test.txt ; stat -c '%s' test.txt
      32000
      49800
      [root@test ~]# tr -dc '[:alnum:] \n' </dev/urandom | head -c 32001 > test.txt ; stat -c '%s' test.txt ; iconv -f ISO-8859-1 -t UTF-8 test.txt -o test.txt ; stat -c '%s' test.txt
      32001
      50012
      [root@test ~]# tr -dc '[:alnum:] \n' </dev/urandom | head -c 32002 > test.txt ; stat -c '%s' test.txt ; iconv -f ISO-8859-1 -t UTF-8 test.txt -o test.txt ; stat -c '%s' test.txt
      32002
      49938
      [root@test ~]# tr -dc '[:alnum:] \n' </dev/urandom | head -c 32003 > test.txt ; stat -c '%s' test.txt ; iconv -f ISO-8859-1 -t UTF-8 test.txt -o test.txt ; stat -c '%s' test.txt
      32003
      Bus error (core dumped)
      28672

      Expected results

      File is converted

      Actual results

      core dump

              skolosov@redhat.com Sergey Kolosov
              rhn-support-jwright Joe Wright
              Florian Weimer, Murali Prudhvi Dhar Rao Ijjapureddi
              Patsy Griffin Patsy Griffin
              Sergey Kolosov Sergey Kolosov
              Votes:
              1 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: