Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 350114 - sys-fs/gt5-1.4.0-r1: "directory seems to be empty"
Summary: sys-fs/gt5-1.4.0-r1: "directory seems to be empty"
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Christoph Mende (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-30 03:57 UTC by Denilson Sá Maia
Modified: 2012-01-25 01:46 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
parse the du --help command to get max-depth in the right way (gt-1.4.0-du-depth.patch,339 bytes, patch)
2011-01-10 22:08 UTC, Martin Gysel (bearsh)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Denilson Sá Maia 2010-12-30 03:57:16 UTC
My system: up-to-date amd64 stable.

How to reproduce:
1. emerge -av gt5
2. Run "gt5 somedir"
3. It will open links with the following page:

gt5 v1.4.0 (hostname:/path/to/somedir)
      directory seems to be empty


I did some testing, and replaced "links" with a script that sleeps for a few seconds and them calls the actual links. This way, I can grab the gt5 output before links is opened. Here is the output:

processing "/path/to/somedir", please be patient ... done 
generating HTML-file ... done (size: 4.0K)
saving state information ... (background)
starting browser (~/bin/links) ... 
links /tmp/gt5.26844.blQ5jLH0/gt5.html

Unfortunately, nothing useful in this output.

After some debugging, I found the reason. Around line 262, it tries to auto-detect the support for "depth" in du:

#can du handle depths?
DEPTH="$(du --help 2>&1 | "$AWK" '
  /depth/{sub(/^[^-]*/,""); sub(/[N ].*/,""); print; exit}
')$((MAX_DEPTH+1))"

In my system, the line that matches /depth/ is this one:
  -d, --max-depth=N     print the total for a directory (or file, with --all)

Then, $DEPTH will contain "-d,6". Then, at line 274:

du -ak$X $DEPTH 2> /dev/null | ...

It will call du with wrong parameters, which will print an error message to the stderr, which is redirected to /dev/null.

The solution is quite simple: change the lines around 262 to:
DEPTH="--max-depth=$((MAX_DEPTH+1))"
or
DEPTH="-d $((MAX_DEPTH+1))"
(this second version, using "-d", should also work on busybox version of du)

P.S. (a little off-topic): Ubuntu has a different (more updated?) version of gt5. However, that version still contains this bug, and additionally prints an error (gt5_substr_After: command not found) while running. The package version in Ubuntu is 1.5.0.something, although the script has version 1.4.0.1. Anyway that version has been completely rewritten and has new bugs, so it's better to keep with 1.4.0 that we already have in Gentoo.
Comment 1 Martin Gysel (bearsh) 2011-01-10 22:08:30 UTC
Created attachment 259505 [details, diff]
parse the du --help command to get max-depth in the right way

it seems you can also only add a comma at the right place, see attached patch
Comment 2 Christoph Mende (RETIRED) gentoo-dev 2011-02-19 16:58:59 UTC
thanks, added your patch
Comment 3 Vladimir Panteleev 2012-01-25 01:46:05 UTC
This patch seems to break behavior on all systems which it does not fix.

You should have added a question mark after the comma you inserted. That way, it'd match both the old and new line.