Ticket #2910 (closed defect: fixed)
"empty" diff.gz if entered from symlink
Reported by: | onlyjob | Owned by: | andrew_b |
---|---|---|---|
Priority: | major | Milestone: | 4.8.7 |
Component: | mc-vfs | Version: | master |
Keywords: | Cc: | ||
Blocked By: | Blocking: | ||
Branch state: | merged | Votes for changeset: | committed-master committed-stable |
Description
MC show "empty" diff.gz if entered from symlink:
When I inspect .diff.gz files MC shows their contents properly.
But when I'm trying to browse the very same diff.gz from symlink it looks empty:
To reproduce using the attached sample libmkv_1-0.2.diff.gz:
ln -s libmkv_1-0.2.diff.gz libmkv_1-0.2-symlink.diff.gz
then [Enter] into libmkv_1-0.2-symlink.diff.gz
More info: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=689258
Thank you.
Attachments
Change History
comment:1 follow-ups: ↓ 2 ↓ 3 Changed 12 years ago by andrew_b
- Cc kdave added
- Component changed from mc-core to mc-vfs
I've created a quick patch but I'm not sure that it is correct.
comment:2 in reply to: ↑ 1 Changed 12 years ago by onlyjob
Replying to andrew_b:
I've created a quick patch but I'm not sure that it is correct.
Thank you for patch. I'm testing it and so far it works well.
I don't see any regressions and it fixes the issue.
comment:3 in reply to: ↑ 1 ; follow-up: ↓ 4 Changed 12 years ago by kdave
Replying to andrew_b:
I've created a quick patch but I'm not sure that it is correct.
This will not work for multiple hops, perl's readlink will read only the link content and will not resolve all levels. There is a module File::Spec::Link that is able to wrap the symlink resolution, but it's not installed by default, so you have to follow the symlink path manually, or 'use Cwd; $fin = realpath $ARGV[1];' that will resolve it to absolute path, but I'm not sure if this works correctly inside the vfs directories.
Other than that, do the resolution unconditionally:
my $fin = readlink $ARGV[1];
comment:4 in reply to: ↑ 3 ; follow-up: ↓ 10 Changed 12 years ago by andrew_b
Replying to kdave:
Replying to andrew_b:
I've created a quick patch but I'm not sure that it is correct.
This will not work for multiple hops, perl's readlink will read only the link content and will not resolve all levels. There is a module File::Spec::Link that is able to wrap the symlink resolution, but it's not installed by default, so you have to follow the symlink path manually
Seems it's not so hard:
while (-l $fin) { $fin = readlink $fin; }
comment:5 Changed 12 years ago by andrew_b
- Keywords stable-candidate added
- Owner set to andrew_b
- Status changed from new to accepted
- Branch state changed from no branch to on review
- Milestone changed from Future Releases to 4.8.7
Branch: 2910_patch_symlink (parent: master).
changeset:9af54886d6f276c09748e43c8f14f37bc390f09e
comment:7 Changed 12 years ago by angel_il
- Votes for changeset changed from slavazanko to slavazanko angel_il
- Branch state changed from on review to approved
comment:8 Changed 12 years ago by andrew_b
- Status changed from accepted to testing
- Cc kdave removed
- Votes for changeset changed from slavazanko angel_il to committed-master
- Resolution set to fixed
- Branch state changed from approved to merged
Merged to master: [9af54886d6f276c09748e43c8f14f37bc390f09].
comment:9 Changed 12 years ago by andrew_b
- Status changed from testing to closed
- Keywords stable-candidate removed
- Votes for changeset changed from committed-master to committed-master committed-stable
Cherry-picked to 4.8.1-stable: [00c4dd2e3c7faa169ec2274318e337e9c4fa3840].
comment:10 in reply to: ↑ 4 Changed 12 years ago by kdave
Replying to andrew_b:
Seems it's not so hard:
while (-l $fin) { $fin = readlink $fin; }
Indeed, though I'd prefer the equivalent short perl form here:
$fin = readlink $fin while (-l $fin);
:)