All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
83b06b2)
Make mr try to chdir() to the dirname() of any .mrconfig files it's
supposed to load. If the chdir() is successful, then the filename is
truncated to basename(). If the chdir() is unsuccessful, then processing
happens as before.
Signed-off-by: martin f. krafft <madduck@madduck.net>
use strict;
use Getopt::Long;
use Cwd qw(getcwd abs_path);
use strict;
use Getopt::Long;
use Cwd qw(getcwd abs_path);
# things that can happen when mr runs a command
use constant {
# things that can happen when mr runs a command
use constant {
my $trusted;
if (ref $f eq 'GLOB') {
$dir="";
my $trusted;
if (ref $f eq 'GLOB') {
$dir="";
if ($loaded{$absf}) {
return;
}
if ($loaded{$absf}) {
return;
}
}
$dir=abs_path($dir)."/";
}
$dir=abs_path($dir)."/";
+
+ if (chdir($dir)) {
+ $f=basename($f);
+ }
+
if (! exists $configfiles{$dir}) {
$configfiles{$dir}=$f;
}
if (! exists $configfiles{$dir}) {
$configfiles{$dir}=$f;
}
- print "mr: loading config $f\n" if $verbose;
+ if ($f =~ /\//) {
+ print "mr: loading config $f\n" if $verbose;
+ } else {
+ print "mr: loading config $f (from ".getcwd().")\n" if $verbose;
+ }
+
open($in, "<", $f) || die "mr: open $f: $!\n";
}
my @lines=<$in>;
open($in, "<", $f) || die "mr: open $f: $!\n";
}
my @lines=<$in>;
"this can allow arbitrary code execution!)\n";
}
else {
"this can allow arbitrary code execution!)\n";
}
else {
- die "mr: $msg in untrusted $f line $lineno\n".
+ die "mr: $msg in untrusted $absf line $lineno\n".
"(To trust this file, list it in ~/.mrtrust.)\n";
}
};
"(To trust this file, list it in ~/.mrtrust.)\n";
}
};