Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
9
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Open sidebar
Ole Tange
tangetools
Commits
c3267460
Commit
c3267460
authored
Mar 16, 2014
by
Ole Tange
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
tracefile: Deal with chdir and relative files.
parent
671b08de
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletion
+9
-1
tracefile/tracefile
tracefile/tracefile
+9
-1
No files found.
tracefile/tracefile
View file @
c3267460
...
...
@@ -12,12 +12,20 @@ if(not ($opt::exists or $opt::nonexists or $opt::all)) {
}
my
@cmd
=
shell_quote
(
@ARGV
);
my
$dir
=
"
.
";
open
(
IN
,
"
-|
",
"
strace -ff -e trace=file
@cmd
2>&1
")
||
die
;
while
(
<
IN
>
)
{
if
(
/chdir."(([^\\"]|\\[\\"nt])*)".\s*=\s*0/
)
{
$dir
=
$
1
;
}
# [pid 30817] stat("transpose/100000files.tar.gz", {st_mode=S_IFREG|0644, st_size=140853248, ...}) = 0
if
(
s/^[^\"]+"(([^\\"]|\\[\\"nt])*)".*/$1/
)
{
# Matches the strace structure for a file
my
$file
=
shell_unquote
(
$
1
);
# Relative to $dir
$file
=~
s:^([^/]):$dir/$1:
;
my
$print
=
0
;
if
(
$
opt::
all
or
...
...
@@ -29,7 +37,7 @@ while(<IN>) {
if
(
$
opt::
unique
and
$seen
{
$file
}
++
)
{
$print
=
0
;
}
$print
and
print
;
$print
and
print
$file
,"
\n
"
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment