Opened 11 years ago

Closed 11 years ago

#3249 closed defect (fixed)

File names containing colon results in automatic file overwrite

Reported by: jnvsor Owned by:
Priority: minor Component: ffmpeg
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

When using colons in file names (And adding the file:// protocol to prevent ffmpeg mistaking filename for protocol) ffmpeg automatically overwrites any existing file without prompt.

ffmpeg -i in.avi "file://$HOME/out:file.webm"
# creates file
ffmpeg -i in.avi "file://$HOME/out:file.webm"
# No overwrite prompt
ffmpeg -i in.avi out-file.webm
# creates file
ffmpeg -i in.avi out-file.webm
# Overwrite prompt

Attachments (1)

beastd-file-overwrite-hackish-partial-fix.diff (627 bytes ) - added by Alexander Strasser 11 years ago.
Hackish change that fixes one part of this issue

Download all attachments as: .zip

Change History (8)

comment:1 by Alexander Strasser, 11 years ago

Analyzed by developer: set
Reproduced by developer: set

I can see it here too.

Seems the heuristic in function assert_file_overwrite in ffmpeg_opt.c is not recognizing those colon file names as file names.

comment:2 by Alexander Strasser, 11 years ago

Status: newopen

in reply to:  1 comment:3 by Alexander Strasser, 11 years ago

Replying to beastd:

Seems the heuristic in function assert_file_overwrite in ffmpeg_opt.c is not recognizing those colon file names as file names.

I wonder if the heuristic is needed when opening output files. I guess not.

But there might be other places where it helps.

by Alexander Strasser, 11 years ago

Hackish change that fixes one part of this issue

comment:4 by Alexander Strasser, 11 years ago

I attached a hackish patch that fixes the problem for file: output files. But it still has problems for file: specifications that refer to relative file names without using ./ or ../.

I assume it could even do very wrong things depending on the exact file name provided. So do not use it if you cannot guarantee that you file names are always absolute or relative names start with ./ or ../.

I am still searching for a way to fix this properly for all cases including the ones that do not specify file: names.

comment:5 by Alexander Strasser, 11 years ago

Patch series sent to ffmpeg-devel ML for discussion:

http://thread.gmane.org/gmane.comp.video.ffmpeg.devel/172819

Testing welcome.

comment:6 by Alexander Strasser, 11 years ago

Part of this is fixed in ffmpeg git master
commit 77015443a84bb5dbed38eafc2ea26a2bf2641ed6

So if you always use the file:<path> syntax the overwrite check will now work.

comment:7 by Alexander Strasser, 11 years ago

Resolution: fixed
Status: openclosed

Other part of this ticket should be fixed now since:

commit 2b17c7685fd3ff0bffaf3b45458d4a6283f3935f
ffmpeg_opt: assert_file_overwrite: Work for all file protocol outputs

Note: See TracTickets for help on using tickets.