rbouqueau / gpac

GPAC mirror from the SourceForge Subversion
GNU Lesser General Public License v2.1
0 stars 1 forks source link

[Bug] mp4box is unable to process files with apostrophe (') in the filename [sf#310] #310

Open rbouqueau opened 10 years ago

rbouqueau commented 10 years ago

Reported by julianmayer on 2014-05-07 20:08 UTC mp4box (svn trunk as of today as well as older versions) is unable to process files that contain a apostrophe (') in the filename:

$ ./MP4Box -v -enable 3 "test'.mp4" Saving test'.mp4: 0.500 secs Interleaving Error renaming file out_test'.mp4 to test'.mp4

please fix this or give me a hint how to do it myself

rbouqueau commented 10 years ago

Commented by jeanlf on 2014-05-12 11:58 UTC Hmm which platform are you using ? latest SVN works fine for that on windows/OSX/ubuntu ...

rbouqueau commented 10 years ago

Commented by julianmayer on 2014-05-12 12:19 UTC i'm on Mac OS X 10.9.2

SVN r5244

rbouqueau commented 10 years ago

Commented by jcdufourd on 2014-05-14 08:06 UTC I'm also using Mac OSX 10.9.2, on r5254 now. I confirm the bug, but not with that command line. I have tried with a file whose track 3 is enabled, so I need to -disable it to get mp4box to rewrite the file.

rbouqueau commented 10 years ago

Commented by julianmayer on 2014-05-14 08:34 UTC yes the problem only happens when the file is actually modified and written out. need to use "enable" or "disable" to make sure a change is actually ocurring.

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-05-14 09:12 UTC I know what happens. Our rename function internally relies on "mv 'file1' 'file2'". Look at the quotes. So if your filename includes a single quote, it indeed doesn't work.

NB: we needed to rely on "mv" otherwise changes to different filesystems were not taken correctly into account.

NB2: commit adding the quotes https://sourceforge.net/p/gpac/code/4410/

Does any of you can see an easy way to fix this?

rbouqueau commented 10 years ago

Commented by julianmayer on 2014-05-14 09:23 UTC if you 1.) change the MV command to use double quotes instead of single quotes 2.) make sure the filenames are properly escaped with backslashes (perhaps this already is done?)

it should work. tested ad-hoc on the command line

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-05-14 12:50 UTC Ok, that's much complex than that. If you set double-quote, the system() function (which relies on '/bin/sh' on Unix) may interpret many symbols which is not security-proof.

I'm having a look...

rbouqueau commented 10 years ago

Commented by rbouqueau on 2014-05-14 13:20 UTC I made this: http://sourceforge.net/p/gpac/code/5255

Can you confirm it solves the issue?

rbouqueau commented 10 years ago

Commented by julianmayer on 2014-05-14 13:46 UTC thanks this fixes the issue for me.

since the "Error renaming file" errors seem to crop up every few years on different platforms, perhaps files with exotic filenames could be added to the testsuite

“}Ωª}a a“¡ª¡“¶¢®¢.mp4 "œƒ@∑∆¡||¡ ±±-.mp4 Óӈω'⁄⁄⁄///77||||\.mp4

;)