Bug 4940 - Error! url:[0] is empty or a track could not be read
: Error! url:[0] is empty or a track could not be read
Status: CLOSED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Platform Support
: 6.5.1
: All Linux (other)
: P2 normal (vote)
: ---
Assigned To: Squeezebox QA Team email alias
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2007-04-26 03:21 UTC by Peter Marquardt
Modified: 2008-12-18 11:11 UTC (History)
1 user (show)

See Also:
Category: ---


Attachments
handle 0 folder (2.44 KB, patch)
2007-04-26 16:49 UTC, KDF
Details | Diff
patch Slim/Utils/Text.pm to handle '0' strings (1.12 KB, patch)
2007-04-27 03:03 UTC, Peter Marquardt
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Marquardt 2007-04-26 03:21:40 UTC
never ever compare strings logically 8-)

Bug: Slimserver does not honor directories called "0"

to verify:

$ mkdir /myslimlibrary/0 /myslimlibrary/1 /myslimlibrary/a /myslimlibrary/_
$ cp test.mp3 /myslimlibrary/0 /myslimlibrary/1 /myslimlibrary/a /myslimlibrary/_

configure slimserver to use /myslimlibrary/

navigate into Browse/Music Folder/

smile 8-) bug found. 

[before someone comlains about directory-names like that: a (more or less simple) perlsscript is used to recure through my mp3-collection, grabbing the first letter of either the directory or the song. then symlink to this mp3 is created inside the first-letter-directory. this makes navigating through a library with more than 50k mp3 easy as anything.]

suggested fix: dunno where to look for it...
Comment 1 Peter Marquardt 2007-04-26 05:04:54 UTC
... well above unix command lines are buggy also 8-)

i meant:

$ mkdir /myslimlibrary
$ cd /myslimlibrary
$ for i in 0 1 _ a; do cp /somewhere/test.mp3 $i;done # to have at least one mp3 inside
Comment 2 Peter Marquardt 2007-04-26 05:06:52 UTC
(In reply to comment #1)


ARGH... forgot to mkdir 8-) (should get into bed)

$ mkdir /myslimlibrary
$ cd /myslimlibrary
$ for i in 0 1 _ a; do mkdir $i && cp /somewhere/test.mp3 $i;done # to have at least one
Comment 3 KDF 2007-04-26 10:48:43 UTC
It seems that Buttons::BrowseTree::browseTreeExitCallback is sending the 0 to the track info mode.  loadTrackInfo is written to expect a url, so there is a premature conversion going on.  Another clue to the origin is that it affects the we UI as well (folder named 0 isn't listed).

I've managed to reproduce the problem, so I can trace it back. thanks.
Comment 4 KDF 2007-04-26 16:49:28 UTC
Created attachment 1916 [details]
handle 0 folder

I believe this should cover it.  Made a big mess tracing back to catch all of the cases, so the patch is stripped of cruft and should hopefully be left with only the useful bits.  This avoids the error to allow descending into the folder, also fixes the web ui folder listing, the pwd_list once descended into the folder, and finally allows the display to show the "0" when it is the only character in the display hash.
Comment 5 Peter Marquardt 2007-04-27 02:11:55 UTC
> I believe this should cover it.

Yeah! Say "hello" to my "0" directoy 8-) thanks.

> Made a big mess tracing back to catch all of
> the cases, so the patch is stripped of cruft and should hopefully be left with
> only the useful bits.

Just applied the patch to http://www.slimdevices.com/downloads/nightly/latest/6.5/SlimServer_6.5_v2007-04-27.tar.gz and it works almost fine.

I'm digging into it, but now I have:


2007-04-27 10:37:19.5497 Use of uninitialized value in string comparison (cmp) at /SlimServer_6.5_v2007-04-27/Slim/Music/Info.pm line 667.
2007-04-27 10:37:19.5499 Use of uninitialized value in string comparison (cmp) at /SlimServer_6.5_v2007-04-27/Slim/Music/Info.pm line 667.
2007-04-27 10:37:19.5500 Use of uninitialized value in string comparison (cmp) at /SlimServer_6.5_v2007-04-27/Slim/Music/Info.pm line 667.

ok, dug it.

in my (rare) case of mp3-folder-structure like this:

wwwutz@warthole$ ls -lL
total 22796
drwxr-sr-x   2 wwwutz   mp3grp        33 Apr 26 12:07 0
-rw-r--r--   1 wwwutz   mp3grp   4528716 Oct  5  2006 12- Missfits - Flasch.mp3
-rw-r--r--   1 wwwutz   mp3grp   2428471 Aug  8  2003 2.04- Elaekelaeiset - Humppaa Tai Kuole.mp3
-rw-r--r--   1 wwwutz   mp3grp   4873532 Aug  8  2003 2.09- Elaekelaeiset - Humppaan Itsekseni.mp3
-rw-r--r--   1 wwwutz   mp3grp   2459818 Aug  8  2003 2.19- Elaekelaeiset - Kahvipakettihumppa.mp3
-rw-r--r--   1 wwwutz   mp3grp   9045676 Oct 21  2002 Peter Gabriel - Biko (Live).mp3
drwxr-sr-x   2 wwwutz   mp3grp        43 Apr 26 12:08 _

the array @nocase Slim/Music/Info.pm line 664: sortFilename() contains (Data::Dumper):

$VAR1 = [
          undef,
          '12 MISSFITS FLASCH MP3',
          '2 04 ELAEKELAEISET HUMPPAA TAI KUOLE MP3',
          '2 09 ELAEKELAEISET HUMPPAAN ITSEKSENI MP3',
          '2 19 ELAEKELAEISET KAHVIPAKETTIHUMPPA MP3',
          'PETER GABRIEL BIKO LIVE MP3',
          '_'
        ];

whereas the undef seems to be the result of

Slim::Utils::Text::matchCase('0') which delivers an empty string '' (not yet undef)

and 

Slim::Utils::Text::ignorePunct('') results in 'undef'

Fix: maybe ignorePunct('') should be fixed  ?

Slim::Utils::Text::ignorePunc
sub ignorePunct {
        my $s = shift || return undef;
[...]

lets test this:

wwwutz@warthole$ perl -de shell

Loading DB routines from perl5db.pl version 1.28
Editor support available.

Enter h or `h h' for help, or `man perldebug' for more help.

main::(-e:1):   shell
  DB<1> $a='';$a || print "xxx\n"
xxx

  DB<2> $a='0';$a || print "xxx\n"
xxx

  DB<3> $a='1';$a || print "xxx\n"


so, that seems to be the problem.





Comment 6 Peter Marquardt 2007-04-27 02:49:43 UTC
> Fix: maybe ignorePunct('') should be fixed  ?
> 
> Slim::Utils::Text::ignorePunc
> sub ignorePunct {
>         my $s = shift || return undef;
> [...]


same issue for matchCase, ignoreArticles etc... in Slim::Utils::Text.

They all tend to reply undef on getting a '0'..

suggested fix: replace all

sub function {
    my $s = shift || return undef;

with 

sub function {
    my $s = shift;
    return undef unless defined $s;

or for the funny side of perl:

sub function {
    my $s = shift;
    return $s unless defined $s;

8-)

Comment 7 Peter Marquardt 2007-04-27 03:03:34 UTC
Created attachment 1918 [details]
patch Slim/Utils/Text.pm to handle '0' strings

to check if a string is defined or empty failes with '0' as string when using || comparism.

this patch returns undef when undef comes as parameter

beware it does deliver an empty string to the function. this might not be the right behaviour.
Comment 8 KDF 2007-04-27 12:02:43 UTC
Thanks for flagging those, Peter.  I'll test a slightly altered version of this patch today.
Comment 9 KDF 2007-04-27 17:36:05 UTC
fixed in 6.5.2 at change 11846
and in trunk at change 11847
please reopen if there are any remaining issues.
Comment 10 Chris Owens 2007-05-22 12:10:28 UTC
Fixed in 6.5.2, which is now released and available for download at http://www.slimdevices.com/su_downloads.html

If you're still experiencing this bug, please re-open it!