Skip to content

Update Cwd.pm to work on Guix & NixOS #18752

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ François Désarménien <desar@club-internet.fr>
François Perrad <francois.perrad@gadz.org>
Frederic Briere <fbriere@fbriere.net>
Fréderic Chauveau <fmc@pasteur.fr>
Frosku <frosku@frosku.com>
Fyodor Krasnov <fyodor@aha.ru>
G. Del Merritt <del@intranetics.com>
Gabe Schaffer
Expand Down
4 changes: 3 additions & 1 deletion dist/PathTools/Cwd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use strict;
use Exporter;


our $VERSION = '3.80';
our $VERSION = '3.81';
my $xs_version = $VERSION;
$VERSION =~ tr/_//d;

Expand Down Expand Up @@ -155,6 +155,8 @@ if($^O ne 'MSWin32') {
foreach my $try ('/bin/pwd',
'/usr/bin/pwd',
'/QOpenSys/bin/pwd', # OS/400 PASE.
'/run/current-system/profile/bin/pwd', # GUIX
'/run/current-system/sw/bin/pwd' # NixOS
Comment on lines +158 to +159
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Importantly, Nix's concept of closures is very important and highly valued. It is very common to export a closure and run it elsewhere, where /run/ doesn't exist in any form. This works "sometimes" but intentionally sidesteps the design philosophy of Nix, creating software artifacts that appear to work in development and then fails on deployment due to cheating like this.

) {
if( -x $try ) {
$pwd_cmd = $try;
Expand Down