Symbolic links can create recursive loop that causes Baobab to never finish scanning

Bug #997391 reported by vdude
64
This bug affects 10 people
Affects Status Importance Assigned to Milestone
baobab (Fedora)
Fix Released
Undecided
ntfs-3g (Debian)
Fix Released
Unknown
ntfs-3g (Fedora)
Fix Released
Medium
ntfs-3g (Ubuntu)
Fix Released
Medium
Unassigned
Precise
Fix Released
Medium
Unassigned

Bug Description

= Stable Release Update discussion =
== Impact ==
readdir() returns the directory type for junction points (NTFS symbolic links). This causes baobab to go into an endless loop when scanning an NTFS file-system. Older baobabs used stat() which correctly identified junction points as being symlinks.

This would affect all users who run baobab on a Windows 7 (or later) root file-system. For dual-booting users, that's fairly likely to be where they store most of their media (it's accessible from both OSs), and thus the file-system most likely to be full and need the help of baobab.

== Test Case ==
* Mount a Windows 7 root filesystem.
* Run baobab on Users/somebody/Local\ Settings/Application\ Data (or just the whole file-system).
* If affected by this bug, it will appear to take forever to scan, and under strace it's obvious that it's following an endless loop of symlinks.

== Regression potential ==
The patch is limited to readdir() and simply adds support for more types of file. It is not trivial, but is readable and seems plausible.

Fedora appear are also backporting this patch to F17.

= Original report =
1) The release of Ubuntu you are using, via 'lsb_release -rd' or System -> About Ubuntu
Ubuntu 12.04 LTS

2) The version of the package you are using, via 'apt-cache policy pkgname' or by checking in Software Center
3.4.1-0ubuntu1

3) What you expected to happen
Detect the presence of symbolic link and omit directories under the link

4) What happened instead
Scans directories under the symbolic link, which is in reference to the directory above the symbolic link, and continue scanning without completion.

Case in which bug was discovered:
When scanning an NTFS drive with Windows 7 installed, the Users\System\AppData\Local\ directory contains a symlink called "Application Data" back to the Users\System\AppData\Local\ directory. This is used to maintain legacy support for older programs that require the Application Data folder. However, when Baobab reaches this point, it assumes that this continues to an infinite depth, and never completes the scan.

Workaround:
Omit scanning of the directory that is known to contain such links.

Revision history for this message
In , Simon (simon-redhat-bugs) wrote :

Description of problem:
when i let baobab scan a windows 7 partition it keeps getting into infinite loops because of some symlinks.

Version-Release number of selected component (if applicable):
3.4.0

How reproducible:
always

Steps to Reproduce:
1. let baobab scan an ntfs partition with this special kind of symlink
2.
3.

Actual results:
baobab follows the symlink

Expected results:
baobab skips the symlink

Additional info:
there is something special about this kind of symlinks,
stat reports that it is a symlink, but that it has 2 links, which is the only difference I see from the normal symlinks

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in baobab (Ubuntu):
status: New → Confirmed
Revision history for this message
In , Erik (erik-redhat-bugs) wrote :

Created attachment 605323
Proposed patch (created by upstream)

Hi,

While investigating an issue with baobab (gnome disk usage tool, bug 811399) I found out that ntfs-3g returns an invalid result when a junction point (symbolic link) is detected. Whenever a junction point is detected, the readdir syscall thinks that the file in question is a directory while it actually is a symbolic link.

I filed this issue upstream along with a testcase and they provided a fix for this issue. I tested this patch on my Fedora 17 x86_64 environment and it indeed does resolve the baobab issue.

Could you please apply this patch in the ntfs-3g package for now?

For more details, see:
https://bugzilla.redhat.com/show_bug.cgi?id=811399
https://bugzilla.gnome.org/show_bug.cgi?id=672219
http://tuxera.com/forum/viewtopic.php?f=2&t=29578

Revision history for this message
In , Erik (erik-redhat-bugs) wrote :

This bug is caused by a bug in the ntfs-3g package.

A bugreport was filed upstream and they've already proposed a patch which resolves this issue: http://tuxera.com/forum/viewtopic.php?f=2&t=29578

I just filed a ticket to the ntfs-3g maintainer in Fedora asking to apply this patch in the Fedora ntfs-3g package: bug 849332

Revision history for this message
Stefano Rivera (stefanor) wrote :

Upstream bug report including patch: http://tuxera.com/forum/viewtopic.php?f=2&t=29578

Revision history for this message
In , Tom (tom-redhat-bugs) wrote :

Erik, the patch you attached is seriously malformed (how did you manage that?), but I found the correct patch from the tuxera link. Update is coming, thanks.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/ntfs-3g-2012.1.15-3.fc17

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc18 has been submitted as an update for Fedora 18.
https://admin.fedoraproject.org/updates/ntfs-3g-2012.1.15-3.fc18

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

Package ntfs-3g-2012.1.15-3.fc18:
* should fix your issue,
* was pushed to the Fedora 18 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing ntfs-3g-2012.1.15-3.fc18'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2012-12261/ntfs-3g-2012.1.15-3.fc18
then log in and leave karma (feedback).

Revision history for this message
In , Erik (erik-redhat-bugs) wrote :

(In reply to comment #1)
> Erik, the patch you attached is seriously malformed (how did you manage
> that?), but I found the correct patch from the tuxera link. Update is
> coming, thanks.

I don't know what went wrong, but when I perform 'wget https://bugzilla.redhat.com/attachment.cgi?id=605323' it returns a proper patch here. Anyway, you managed to get the patch from upstream so everything is good now.

Thanks for the quick update!

Revision history for this message
In , Erik (erik-redhat-bugs) wrote :

Sorry for the reassign noise. Some firefox extension messed up the bugzilla form..

Revision history for this message
Xero Xenith (xero-xenith) wrote :

Confirmed here, any chance of a patch for Quantal?

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ntfs-3g - 1:2012.1.15AR.5-4ubuntu2

---------------
ntfs-3g (1:2012.1.15AR.5-4ubuntu2) quantal; urgency=low

  * ntfs-3g-junction-point-fix.patch: Return the correct type (DT_LINK) for
    NTFS Junction points, in readdir(). (LP: #997391)
 -- Stefano Rivera <email address hidden> Tue, 21 Aug 2012 22:27:42 +0200

Changed in ntfs-3g (Ubuntu):
status: New → Fix Released
no longer affects: baobab (Ubuntu)
Changed in ntfs-3g (Debian):
status: Unknown → Fix Released
Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc17 has been submitted as an update for Fedora 17.
https://admin.fedoraproject.org/updates/FEDORA-2012-12279/ntfs-3g-2012.1.15-3.fc17

Changed in ntfs-3g (Ubuntu Precise):
importance: Undecided → Medium
Changed in ntfs-3g (Ubuntu):
importance: Undecided → Medium
description: updated
Revision history for this message
Stefano Rivera (stefanor) wrote :
Changed in ntfs-3g (Ubuntu Precise):
status: New → Fix Committed
Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc17 has been pushed to the Fedora 17 stable repository. If problems still persist, please make note of it in this bug report.

Revision history for this message
Adam Conrad (adconrad) wrote : Please test proposed package

Hello vdude, or anyone else affected,

Accepted ntfs-3g into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/ntfs-3g/1:2012.1.15AR.1-1ubuntu1.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

tags: added: verification-needed
Revision history for this message
Adam Conrad (adconrad) wrote :

Hello vdude, or anyone else affected,

Accepted ntfs-3g into precise-proposed. The package will build now and be available at http://launchpad.net/ubuntu/+source/ntfs-3g/1:2012.1.15AR.1-1ubuntu1.2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please change the bug tag from verification-needed to verification-done. If it does not, change the tag to verification-failed. In either case, details of your testing will help us make a better decision.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance!

Revision history for this message
Storm Joubert (stormf) wrote :

Tested after applying the update. Scanning a windows 7 root filesystem now completes.

tags: added: verification-done
removed: verification-needed
Revision history for this message
dst (dast) wrote :

Great, thanks! I was affected, too, and now it works fine.

Revision history for this message
In , Fedora (fedora-redhat-bugs) wrote :

ntfs-3g-2012.1.15-3.fc18 has been pushed to the Fedora 18 stable repository. If problems still persist, please make note of it in this bug report.

Revision history for this message
Colin Watson (cjwatson) wrote : Update Released

The verification of this Stable Release Update has completed successfully and the package has now been released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regresssions.

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ntfs-3g - 1:2012.1.15AR.1-1ubuntu1.2

---------------
ntfs-3g (1:2012.1.15AR.1-1ubuntu1.2) precise-proposed; urgency=low

  * Add readonly-devices.patch: Mount read-only devices as read-only instead
    of failing. Thanks to Jean Pierre Andre for the patch! (LP: #435192)

ntfs-3g (1:2012.1.15AR.1-1ubuntu1.1) precise-proposed; urgency=low

  * ntfs-3g-junction-point-fix.patch: Return the correct type (DT_LINK) for
    NTFS Junction points, in readdir(). (LP: #997391) Junction points are the
    NTFS equivalent of symlinks and should be listed as such. Fixes an
    infinite loop in baobab when scanning a Windows 7 root file system.
 -- Martin Pitt <email address hidden> Tue, 11 Sep 2012 05:49:00 +0200

Changed in ntfs-3g (Ubuntu Precise):
status: Fix Committed → Fix Released
Revision history for this message
UlfZibis (ulf-zibis) wrote :

Hi,
did you consider, that on NTFS there are 2 types of symbolic links?
- the so called junctions, which only allow absolute target paths.
- less known real symlinks, which also alow relative target paths: http://en.wikipedia.org/wiki/Symbolic_link#Windows_7_.26_Vista_symbolic_link.
(I do not mean the 3rd variant, which is called shortcut and doesn't count for link)

Revision history for this message
Stefano Rivera (stefanor) wrote : Re: [Bug 997391] Re: Symbolic links can create recursive loop that causes Baobab to never finish scanning

Please raise that with the upstream. I applied the patch that had been
applied to the upstream VCS.

Changed in baobab (Fedora):
importance: Unknown → Undecided
status: Unknown → Fix Released
Changed in ntfs-3g (Fedora):
importance: Unknown → Medium
status: Unknown → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.