Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#5384 closed defect (invalid)

Command line tools fail to open file with ':' char in filename

Reported by: ahthovaikied Owned by:
Priority: minor Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

ffmpeg of ffprobe can fail to open file if a ':' char is in the filename.

For example :
passing 'a.png' works
passing 'a:.png' does not work
but passing './a:.png' does work

$ wget https://ffmpeg.org/img/ffmpeg3d_white_20.png -O a.png

$ ./ffprobe a.png 
ffprobe version N-79145-ge259dc8 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --disable-runtime-cpudetect --disable-ffserver --disable-encoder=vorbis --disable-encoder=aac --enable-x11grab --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --disable-debug --cpu=corei7
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 31.100 / 57. 31.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from 'a.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, ya8(pc), 20x20 [SAR 72:72 DAR 1:1], 25 tbr, 25 tbn, 25 tbc

$ mv a.png a:.png

$ ./ffprobe a:.png 
ffprobe version N-79145-ge259dc8 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --disable-runtime-cpudetect --disable-ffserver --disable-encoder=vorbis --disable-encoder=aac --enable-x11grab --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --disable-debug --cpu=corei7
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 31.100 / 57. 31.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
a:.png: Protocol not found

$ ./ffprobe ./a:.png 
ffprobe version N-79145-ge259dc8 Copyright (c) 2007-2016 the FFmpeg developers
  built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.1)
  configuration: --pkg-config-flags=--static --enable-gpl --enable-version3 --enable-nonfree --disable-runtime-cpudetect --disable-ffserver --disable-encoder=vorbis --disable-encoder=aac --enable-x11grab --enable-libfdk-aac --enable-libfontconfig --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --disable-debug --cpu=corei7
  libavutil      55. 19.100 / 55. 19.100
  libavcodec     57. 31.100 / 57. 31.100
  libavformat    57. 29.101 / 57. 29.101
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 40.102 /  6. 40.102
  libswscale      4.  0.100 /  4.  0.100
  libswresample   2.  0.101 /  2.  0.101
  libpostproc    54.  0.100 / 54.  0.100
Input #0, png_pipe, from './a:.png':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: png, ya8(pc), 20x20 [SAR 72:72 DAR 1:1], 25 tbr, 25 tbn, 25 tbc

I presume it tries to parse the filename as an URL, but that behavior seems wrong.

Change History (5)

comment:1 by Carl Eugen Hoyos, 8 years ago

You have to specify the protocol file: to open a file with a colon.

comment:2 by Carl Eugen Hoyos, 8 years ago

Resolution: invalid
Status: newclosed

comment:3 by ahthovaikied, 8 years ago

The fact there is a workaround does not make it an invalid issue IMO.

Open a shell in directory with a filename with a ':' in it, type ffprobe <TAB> <ENTER>, 'Protocol not found' is kind of unexpected here.

git for example handles various protocol for its remote strings (ie. with git clone) and if file:// is omitted, it correctly interprets the string as a filename, even if it contains ':'.

in reply to:  3 comment:4 by Carl Eugen Hoyos, 8 years ago

Replying to ahthovaikied:

The fact there is a workaround does not make it an invalid issue IMO.

You misunderstand: Using file: is not a workaround for an issue. FFmpeg expects you to specify a protocol and the protocol is identified by the string left of the colon. Only if you don't specify a protocol, file: is assumed. It would be possible to test the protocol string against the existing protocols but since you can choose the available protocols at compile time, the resulting logic would be fragile: You would simply change consistent behaviour that you don't like against inconsistent behaviour depending on unrelated compilation options.

comment:5 by ahthovaikied, 8 years ago

I understand very well. The root issue is that the protocol prefix separator is : in FFmpeg whereas in other programs this is usually ://.
: is a valid char for Unix filesystem file names, but / is not.

In all programs except FFmpeg the behavior is "file:// is implied unless you specify another prefix".
In FFMpeg, the behaviour is "file: is implied unless you specify another prefix or your filename has an : in it, in that case there is ambiguity and you have to be explicit", which is against usual expectations and leads to inconsistent beavior (eg: 'a' or './a:' works but not 'a:').

Note: See TracTickets for help on using tickets.