Bug 536 - Files with ` or " in name cannot be transcoded
: Files with ` or " in name cannot be transcoded
Status: RESOLVED FIXED
Product: Logitech Media Server
Classification: Unclassified
Component: Transcoding
: unspecified
: PC Linux (other)
: P2 normal (vote)
: ---
Assigned To: Blackketter Dean
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2004-09-03 21:41 UTC by Christian
Modified: 2011-03-16 04:39 UTC (History)
2 users (show)

See Also:
Category: ---


Attachments
Proposed patch (540 bytes, patch)
2004-09-03 21:43 UTC, Christian
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Christian 2004-09-03 21:41:00 UTC
Files with ` (decimal 96 in ISO Latin 1) or " (decimal 34) in name cannot be 
transcoded, because the ` is the delimiter for the shell command and the " 
encloses the filename in $command.

The attached patch escapes these two characters in $filepath. Then it works. :-)
Comment 1 Christian 2004-09-03 21:43:27 UTC
Created attachment 123 [details]
Proposed patch
Comment 2 Blackketter Dean 2004-09-04 08:59:21 UTC
*** Bug 228 has been marked as a duplicate of this bug. ***
Comment 3 Blackketter Dean 2004-09-04 08:59:33 UTC
I imagine that there are other characters that also need to be escaped for the shell.  Seems like it could 
be a single regexp.  
Comment 4 KDF 2004-09-09 10:11:41 UTC
if this single regexp was put in pathFromFileURL, we might be abl eto use this
to fix the other problems caused by ' and ", (likely * too),etc.  Such as bug42
and bug454.
Comment 5 KDF 2004-09-20 10:17:30 UTC
This should be fixed in latest nightly, I believe. Please confirm.
Comment 6 KDF 2004-09-20 10:26:29 UTC
I see in the code comment that it is meant to escape $ and *, but the code only
seems to escape ' " and $

# escape $ and * in file names and URLs.
$filepath =~ s/([\$\"\`])/\\$1/g;
$fullpath =~ s/([\$\"\`])/\\$1/g;

seems it should be:
# escape special characters in file names and URLs.
$filepath =~ s/([\$\"\`\*])/\\$1/g;
$fullpath =~ s/([\$\"\`\*])/\\$1/g;
Comment 7 Blackketter Dean 2004-09-20 22:32:46 UTC
That's right.  The path name is in quotes, so the * isn't expanded by the shell.  This isn't true for 
backtick, dollar and double-quote.  Is it failing for you?
Comment 8 KDF 2004-09-20 22:36:25 UTC
no, I dont use those chars in any filename.  I was just curious if something was
missed.  
Comment 9 KDF 2004-09-23 00:43:48 UTC
do we have a confirmation that this now works?
Comment 10 Chris Owens 2006-06-16 14:40:31 UTC
There are 536 bugs in the database with targets of '---' that were fixed prior to new year 2006.  I am setting them to targets of 6.2.1 to keep them from showing up in my queries.