Opened 13 months ago

Closed 8 months ago

Last modified 6 months ago

#9057 closed task (fixed)

Remove /usr/bin/… references

Reported by: Fuuzetsu Owned by:
Priority: low Milestone: 7.10.1
Component: Build System Version: 7.8.2
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: None/Unknown Test Case:
Blocked By: Blocking:
Related Tickets: Differential Revisions: Phab:D237

Description

The use of /usr/bin/perl in sync-all makes it difficult to work with on distros which don't store binaries in /usr/bin, such as NixOS.

A more portable solution would be to use /usr/bin/env perl. It'd be very nice if someone turned such shebangs to use env rather than direct reference.

Change History (9)

comment:1 Changed 13 months ago by Joachim Breitner <mail@…>

In 34db5ccf52ec2a1b5e953c282d0c52a7fc82c02a/ghc:

Replace all #!/usr/bin/perl with #!/usr/bin/env perl

As suggested in #9057.

comment:2 Changed 13 months ago by nomeata

  • Resolution set to fixed
  • Status changed from new to closed

Quite right; fixed.

comment:3 Changed 13 months ago by Fuuzetsu

Ah, while I did say /usr/bin/perl, I should have perhaps said /usr/bin/anything.

./libraries/terminfo/Setup.lhs:#!/usr/local/bin/runhaskell
./libraries/containers/benchmarks/bench-cmp.pl:#!/usr/bin/perl
./distrib/cross-port:#! /bin/bash
./configure:  echo '#! /bin/cat
./testsuite/tests/rename/prog006/Setup.lhs:#!/usr/bin/runhaskell
./utils/count_lines/count_lines.lprl:#! /usr/bin/perl
./utils/pvm/debugger.emacs:#!/bin/csh -f
./utils/pvm/debugger2:#!/bin/csh -f
./compiler/count_bytes:#! /usr/local/bin/perl
./autom4te.cache/output.1:  echo '#! /bin/cat
./autom4te.cache/output.0:  echo '#! /bin/cat

Should I create a separate ticket for above? There are some in ./libraries so I should probably be filing with them, but many aren't.

comment:4 Changed 13 months ago by nomeata

  • Resolution fixed deleted
  • Status changed from closed to new

I’ve reopened the ticket. You can also create a patch (or branch on your github fork) if you feel like it.

How should arguments like in /bin/csh -f be treated?

comment:5 Changed 12 months ago by Fuuzetsu

  • Priority changed from normal to low

As far as I can tell, there's no way to pass such flags to programs while using env and these flags have to be accomodated for on script-by-script basis. So for example #!/usr/bin/perl -w becomes #!/usr/bin/env perl and use warnings; should be set instead of using -w.

I'll look into patching out the paths I mentioned in the following few days if I get some time. It is of no high priority to me at the moment as during the build process my distro's tools patch up the shebangs anyway but it's a matter of principle.

comment:6 Changed 8 months ago by thomie

  • Differential Revisions set to Phab:D237
  • Status changed from new to patch

All fixed, except:

  • libraries are maintained on github
  • configure and autom4te.cache are created are by autotools

comment:7 Changed 8 months ago by Austin Seipp <austin@…>

In d5e4874833054f1789289c433be292ae3e9bd7d0/ghc:

Change all hashbangs to /usr/bin/env (#9057)

Summary:
```
git grep -l '#!' | xargs sed -i 's|#!.*/bin/\([^ ]*\)$|#!/usr/bin/env \1|'
```
and some manual tweaking

Test Plan: harbormaster

Reviewers: austin

Subscribers: hvr, simonmar, ezyang, carter

Differential Revision: https://phabricator.haskell.org/D237

GHC Trac Issues: #9057

comment:8 Changed 8 months ago by thomie

  • Milestone set to 7.10.1
  • Resolution set to fixed
  • Status changed from patch to closed

comment:9 Changed 6 months ago by Austin Seipp <austin@…>

In d997ca85a33f34f9f461096eb1b25d5f25b53072/ghc:

Don't use absolute paths for perl in validate

Summary: This will *not* work on NixOS for example.

Reviewers: austin

Reviewed By: austin

Subscribers: thomie, carter

Differential Revision: https://phabricator.haskell.org/D479

GHC Trac Issues: #9057
Note: See TracTickets for help on using tickets.