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

Process substitution erroneously causes argument word-splitting in ksh

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not a Bug
    • Icon: Undefined Undefined
    • None
    • rhel-9.5
    • ksh
    • None
    • No
    • Low
    • Customer Reported
    • rhel-plumbers
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • None
    • None
    • None
    • None
    • Unspecified
    • Unspecified
    • Unspecified
    • None

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

       

      If "filename" is generated by process substitution, the Korn shell introduces a space before the generated pathname which breaks the command syntax.

      ====

      $ bash -cx 'echo @<(date)'
      + echo @/dev/fd/63
      @/dev/fd/63

      $ ksh -cx 'echo @<(date)'
      + echo @ /dev/fd/3
      @ /dev/fd/3         .>>
      ====

      The Korn shell has split the "@filename" into two arguments which means a real command (other than the demonstration "echo" command) fails as the arguments are now invalid.

       

      Facing this while attempting to use process substitution with a leading @ character (e.g., @<(date). According to the ksh man page observed that , process substitution <(list) or >(list) should expand into a single filename argument. Instead, seems ksh splits this into two arguments (@ and /dev/fd/...).

      What is the impact of this issue to you?

      Customer reported that Re-coding required to avoid Korn shell in this scenario.

      Please provide the package NVR for which the bug is seen:

      In customer's environment:

      $ rpm -qf /bin/ksh
      ksh-1.0.6-4.el9_5.x86_64

      In my test system where issue is reproducible as well:

      1. rpm -q ksh
        ksh-1.0.6-7.el9_6.1.x86_64

        How reproducible is this bug?:

      Always

      Steps to reproduce:

       

      1. Install ksh on a RHEL system.
      1. Run a simple process substitution in ksh with a leading `@`. 
       $ ksh -cx 'echo @<(date)'
         + date
         + echo @ /dev/fd/3
         @ /dev/fd/3   

      Expected results:

       

             The substitution should remain a single token:

      # ksh -cx 'echo @<(date)'
      + echo @/dev/fd/3 
      @/dev/fd/3

       

      Actual results:

       

            ksh splits the expansion into two tokens:

      + echo @ /dev/fd/3
      @ /dev/fd/3
       
      

       

              vmihalko Vincent Mihalkovic
              rhn-support-vshastri Vaishnavi Shastri
              Vincent Mihalkovic Vincent Mihalkovic
              Karel Volný Karel Volný
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: