LMS-Community/slimserver

Hyphen in folder name makes scan crash

stephanvdplas opened this issue · 6 comments

`[24-12-20 12:11:50.3522] main::main (207) Starting Lyrion Music Server scanner (v9.1.0, 1734550017, Wed Dec 18 19:28:15 CUT 2024) perl 5.032001
[24-12-20 12:11:50.9047] Slim::Music::Import::runImporter (581) Starting Slim::Media::MediaFolderScan scan
[24-12-20 12:11:50.9051] Slim::Utils::Scanner::Local::rescan (180) Discovering audio files in F:\Music
[24-12-20 12:11:56.2746] Slim::Schema::Storage::throw_exception (122) Error: DBI Exception: DBD::SQLite::st execute failed: called with 1 bind variables when 3 are needed [for Statement "
INSERT INTO scanned_files
(url, timestamp, filesize)
VALUES
(?, ?, ?)
" with ParamValues: 1='file:///F:/Music/Wendy%20Carlos', 2=1734124017, 3=0]
[24-12-20 12:11:56.2758] Slim::Schema::Storage::throw_exception (122) Backtrace:

frame 0: Slim::Utils::Log::logBacktrace (C:/Program Files/Lyrion/server/Slim/Schema/Storage.pm line 122)
frame 1: Slim::Schema::Storage::throw_exception (C:\Program Files\Lyrion\server\CPAN/DBIx/Class/Storage/DBI.pm line 1007)
frame 2: DBIx::Class::Storage::DBI::ANON (C:/Program Files/Lyrion/server/Slim/Utils/Scanner/Local/Async.pm line 159)
frame 3: Slim::Utils::Scanner::Local::Async::ANON (C:/Program Files/Lyrion/server/Slim/Utils/Scanner/Local/Async.pm line 170)
frame 4: Slim::Utils::Scanner::Local::Async::find (C:/Program Files/Lyrion/server/Slim/Utils/Scanner/Local.pm line 105)
frame 5: Slim::Utils::Scanner::Local::find (C:/Program Files/Lyrion/server/Slim/Utils/Scanner/Local.pm line 392)
frame 6: Slim::Utils::Scanner::Local::rescan (C:/Program Files/Lyrion/server/Slim/Media/MediaFolderScan.pm line 64)
frame 7: Slim::Media::MediaFolderScan::startScan (C:/Program Files/Lyrion/server/Slim/Music/Import.pm line 583)
frame 8: Slim::Music::Import::runImporter (C:/Program Files/Lyrion/server/Slim/Music/Import.pm line 405)
frame 9: Slim::Music::Import::runScan (C:/Program Files/Lyrion/server/scanner.pl line 335)
frame 10: (eval) (C:/Program Files/Lyrion/server/scanner.pl line 329)
frame 11: main::main (C:/Program Files/Lyrion/server/scanner.pl line 499)`

The Wendy Carlos folder contains a folder named "Switched-On boxed set". When removing the hyphen, the scan works. So might be a good idea to escape the hyphens in the folder names.

Could you please double check whether this as a regular hyphen, or some odd character looking like a hyphen? Hyphen certainly aren't a problem per se. As I wrote in the forums I have them all over the place (eg. "best of 00-99" or similar).

You could enable logging for database.sql and have it fail again. That way we'd hopefully see the actually query and parameters LMS is trying to run.

BTW: if you want to paste code you have to wrap it in three backticks.

I'm pretty certain the "hyphen" was U2010 (UTF-8: e2 80 90). That's what gets returned when pulling from MB:

00000070  6d 70 33 0a 20 20 20 20  61 6c 62 75 6d 3a 20 53  |mp3.    album: S|
00000080  77 69 74 63 68 65 64 e2  80 90 4f 6e 20 42 6f 78  |witched...On Box|
00000090  65 64 20 53 65 74 0a                              |ed Set.|

Forum post

Would you be able to reproduce the problem if you added such a character to a track of yours?

No problem creating the file. I'll see if I can reproduce the issue in a Win VM. I may not get to this until later in the day, as I have several contractors working here in the morning.

Attached is a zip containing an small mp3 file within a folder containing Unicode HYPHEN.

$ zip -sf ~/Desktop/Wendy\ Carlos.zip
Archive contains:
  Switched‐On Boxed Set/
  Switched‐On Boxed Set/1.1.mp3
Total 2 entries (12857 bytes)
[beast] $ zip -sf ~/Desktop/Wendy\ Carlos.zip | hexdump -C
00000000  41 72 63 68 69 76 65 20  63 6f 6e 74 61 69 6e 73  |Archive contains|
00000010  3a 0a 20 20 53 77 69 74  63 68 65 64 e2 80 90 4f  |:.  Switched...O|
00000020  6e 20 42 6f 78 65 64 20  53 65 74 2f 0a 20 20 53  |n Boxed Set/.  S|
00000030  77 69 74 63 68 65 64 e2  80 90 4f 6e 20 42 6f 78  |witched...On Box|
00000040  65 64 20 53 65 74 2f 31  2e 31 2e 6d 70 33 0a 54  |ed Set/1.1.mp3.T|
00000050  6f 74 61 6c 20 32 20 65  6e 74 72 69 65 73 20 28  |otal 2 entries (|
00000060  31 32 38 35 37 20 62 79  74 65 73 29 0a           |12857 bytes).|

I'm not able to get 9.1.0 - 1736061599 on Win10x64 to fail the import.

I used Directory Opus' archiver to create the zip, as Windows internal zip would not work - it said to rename the hyphen char.

Wendy Carlos.zip

Ah, if I place the folder on an NTFS formatted thumbdrive, and set that folder as the music folder, the failure will occur.