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

brp-mangle-shebangs breaks with env -S shebangs

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Normal Normal
    • rhel-9.5
    • rhel-8.9.0, rhel-8.10, rhel-9.3.0, rhel-9.4, rhel-9.5, rhel-10.0
    • redhat-rpm-config
    • sst_cs_software_management
    • ssg_core_services
    • 20
    • None
    • False
    • Hide

      None

      Show
      None
    • No
    • Release Note Not Required
    • All
    • None

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

      Packaging a script with this shebang:

      #!/usr/bin/env -S vd -p
      

      Produces scripts with invalid shebang.

      Please provide the package NVR for which bug is seen:

      redhat-rpm-config-282-1.el10
      redhat-rpm-config-207-1.el9
      redhat-rpm-config-201-1.el9
      redhat-rpm-config-131-1.el8

      How reproducible:

      Steps to reproduce

      1.  Build the spec:
      Name:           reproducer-env-flags
      Version:        0
      Release:        0%{?dist}
      Summary:        ...
      License:        MIT
      BuildArch:      noarch
      
      %description
      ...
      
      %prep
      
      %build
      
      %install
      mkdir -p %{buildroot}%{_bindir}
      echo '#!/usr/bin/env -S vd -p' > %{buildroot}%{_bindir}/xxx
      chmod +x %{buildroot}%{_bindir}/xxx
      
      %files
      %{_bindir}/xxx
      

      Expected results

      + /usr/lib/rpm/redhat/brp-mangle-shebangs
      mangling shebang in /usr/bin/xxx from /usr/bin/env -S vd -p to #!/usr/bin/vd -p
      

      Actual results

      + /usr/lib/rpm/redhat/brp-mangle-shebangs
      mangling shebang in /usr/bin/xxx from /usr/bin/env -S vd -p to #!/usr/bin/-S vd -p
      

      Fix available for backporting in https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/285

            mdomonko@redhat.com Michal Domonkos
            mhroncok@redhat.com Miro Hrončok
            packaging-team-maint packaging-team-maint
            Software Management QE Software Management QE
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: