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

brp-mangle-shebangs breaks with env -S shebangs

    • redhat-rpm-config-208-1.el9
    • None
    • None
    • sst_cs_software_management
    • ssg_core_services
    • 21
    • 23
    • None
    • False
    • Hide

      None

      Show
      None
    • No
    • None
    • 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
            Jan Blazek Jan Blazek
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated: