Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Syntax Error in 1.37 #14

Closed
RhinosF1 opened this issue Oct 16, 2021 · 11 comments
Closed

Syntax Error in 1.37 #14

RhinosF1 opened this issue Oct 16, 2021 · 11 comments
Labels
bug Something isn't working
Milestone

Comments

@RhinosF1
Copy link

Describe the bug
Warning: Syntax error [Called from MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe::invokeFFProbe in /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php at line 165] in /srv/mediawiki/w/includes/debug/MWDebug.php on line 498

Technical information:

  • OS: Debian 11
  • Extension Version 76cefce
  • MediaWiki Version 1.37.0-beta
@RhinosF1 RhinosF1 added the bug Something isn't working label Oct 16, 2021
@octfx
Copy link
Member

octfx commented Oct 16, 2021

Seems like the ffprobe invocation failed.
Can you post the response of the following two commands (if shell access is available)?

ffprobe -version

And the probe output for some uploaded file
ffprobe -v quiet -print_format json -show_format -show_streams /srv/mediawiki/w/images/.../file.mp4 (the path needs to be modified)

@RhinosF1
Copy link
Author

rhinos@test3:~$ ffprobe -version
ffprobe version 4.3.2-0+deb11u2 Copyright (c) 2007-2021 the FFmpeg developers
built with gcc 10 (Debian 10.2.1-6)
configuration: --prefix=/usr --extra-version=0+deb11u2 --toolchain=hardened --libdir=/usr/lib/x86_64-linux-gnu --incdir=/usr/include/x86_64-linux-gnu --arch=amd64 --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librabbitmq --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opencl --enable-opengl --enable-sdl2 --enable-pocketsphinx --enable-libmfx --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100
rhinos@test3:~$
rhinos@test3:~$ ffprobe -v quiet -print_format json -show_format -show_streams /mnt/mediawiki-static/test3wiki/8/8b/GlobalNewFiles_test8.png
{
    "streams": [
        {
            "index": 0,
            "codec_name": "png",
            "codec_long_name": "PNG (Portable Network Graphics) image",
            "codec_type": "video",
            "codec_time_base": "0/1",
            "codec_tag_string": "[0][0][0][0]",
            "codec_tag": "0x0000",
            "width": 800,
            "height": 600,
            "coded_width": 800,
            "coded_height": 600,
            "closed_captions": 0,
            "has_b_frames": 0,
            "pix_fmt": "rgb24",
            "level": -99,
            "color_range": "pc",
            "refs": 1,
            "r_frame_rate": "25/1",
            "avg_frame_rate": "0/0",
            "time_base": "1/25",
            "disposition": {
                "default": 0,
                "dub": 0,
                "original": 0,
                "comment": 0,
                "lyrics": 0,
                "karaoke": 0,
                "forced": 0,
                "hearing_impaired": 0,
                "visual_impaired": 0,
                "clean_effects": 0,
                "attached_pic": 0,
                "timed_thumbnails": 0
            }
        }
    ],
    "format": {
        "filename": "/mnt/mediawiki-static/test3wiki/8/8b/GlobalNewFiles_test8.png",
        "nb_streams": 1,
        "nb_programs": 0,
        "format_name": "png_pipe",
        "format_long_name": "piped png sequence",
        "size": "7365",
        "probe_score": 99
    }
}
rhinos@test3:~$ 

@octfx
Copy link
Member

octfx commented Oct 16, 2021

Thanks! I'll test this shortly

@octfx
Copy link
Member

octfx commented Oct 17, 2021

The extension was passing a wrong filepath to ffprobe. Could you test again using the current develop branch?

Also, when and where does the error occur? On a file page or when including a local file using [[File... ?

@RhinosF1
Copy link
Author

RhinosF1 commented Oct 17, 2021

The extension was passing a wrong filepath to ffprobe. Could you test again using the current develop branch?

Which specific commit?

Also, when and where does the error occur? On a file page or when including a local file using [[File... ?

No idea. I picked it up in the logs.

@octfx
Copy link
Member

octfx commented Oct 17, 2021

The extension was passing a wrong filepath to ffprobe. Could you test again using the current develop branch?

Which specific commit?

83af736

@RhinosF1
Copy link
Author

I've applied the patch to the test server, will check back in a day. Can you properly backport it to master?

@octfx
Copy link
Member

octfx commented Oct 17, 2021

Perfect
I'll merge this into master with the following release

@Universal-Omega
Copy link
Contributor

Universal-Omega commented Dec 2, 2021

@octfx

On 1.36 (without the mentioned commit) this is given:

/bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `'/usr/bin/ffprobe' -v quiet -print_format json -show_format -show_streams mwstore://local-backend/local-public/8/80/Example (test).mp3'

full message:

Error running '/usr/bin/firejail' '--quiet' '--profile=/srv/mediawiki/w/includes/shell/firejail.profile' -- /bin/bash '/srv/mediawiki/w/vendor/wikimedia/shellbox/src/Command/limit.sh' ''\''/usr/bin/ffprobe'\'' -v quiet -print_format json -show_format -show_streams mwstore://local-backend/local-public/8/80/Example (test).mp3' 'SB_INCLUDE_STDERR=;SB_CPU_LIMIT=180; SB_CGROUP='\'''\''; SB_MEM_LIMIT=2147483648; SB_FILE_SIZE_LIMIT=104857600; SB_WALL_CLOCK_LIMIT=180; SB_USE_LOG_PIPE=yes': /bin/bash: -c: line 0: syntax error near unexpected token `('
/bin/bash: -c: line 0: `'/usr/bin/ffprobe' -v quiet -print_format json -show_format -show_streams mwstore://local-backend/local-public/8/80/Example (test).mp3'

in addition to this (full backtrace given):

PHP Warning: Syntax error [Called from MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe::invokeFFProbe in /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php at line 165]

from /srv/mediawiki/w/includes/debug/MWDebug.php(499)
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/w/includes/debug/MWDebug.php(499): trigger_error(string, integer)
#2 /srv/mediawiki/w/includes/debug/MWDebug.php(194): MWDebug::sendMessage(string, string, integer)
#3 /srv/mediawiki/w/includes/GlobalFunctions.php(1095): MWDebug::warning(string, integer, integer, string)
#4 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(165): wfLogWarning(string)
#5 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(51): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->invokeFFProbe()
#6 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(72): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->getMetaData()
#7 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(328): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->getStream(string)
#8 /srv/mediawiki/w/includes/poolcounter/PoolCounterWorkViaCallback.php(74): MediaWiki\Extension\EmbedVideo\Media\AudioHandler::MediaWiki\Extension\EmbedVideo\Media\{closure}()
#9 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(162): PoolCounterWorkViaCallback->doWork()
#10 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(342): PoolCounterWork->execute()
#11 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(254): MediaWiki\Extension\EmbedVideo\Media\AudioHandler->getMakeProbeFromPool(LocalFile, string)
#12 /srv/mediawiki/w/includes/filerepo/file/File.php(2315): MediaWiki\Extension\EmbedVideo\Media\AudioHandler->getLongDesc(LocalFile)
#13 /srv/mediawiki/w/includes/page/ImagePage.php(517): File->getLongDesc()
#14 /srv/mediawiki/w/includes/page/ImagePage.php(141): ImagePage->openShowImage()
#15 /srv/mediawiki/w/includes/actions/ViewAction.php(74): ImagePage->view()
#16 /srv/mediawiki/w/includes/MediaWiki.php(531): ViewAction->show()
#17 /srv/mediawiki/w/includes/MediaWiki.php(315): MediaWiki->performAction(ImagePage, Title)
#18 /srv/mediawiki/w/includes/MediaWiki.php(913): MediaWiki->performRequest()
#19 /srv/mediawiki/w/includes/MediaWiki.php(546): MediaWiki->main()
#20 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#21 /srv/mediawiki/w/index.php(46): wfIndexMain()
#22 {main}

when using for example, [[File:Example (test).mp3]]. though at least the embed content still seems to render.

However on 1.37, and with the commit applied, a fatal exception is given when trying to upload an mp3 file:

Call to undefined method FSFile::getLocalRefPath()

from /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(126)
#0 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(157): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->getFilePath()
#1 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(51): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->invokeFFProbe()
#2 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/FFProbe/FFProbe.php(72): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->getMetaData()
#3 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(328): MediaWiki\Extension\EmbedVideo\Media\FFProbe\FFProbe->getStream(string)
#4 /srv/mediawiki/w/includes/poolcounter/PoolCounterWorkViaCallback.php(74): MediaWiki\Extension\EmbedVideo\Media\AudioHandler::MediaWiki\Extension\EmbedVideo\Media\{closure}()
#5 /srv/mediawiki/w/includes/poolcounter/PoolCounterWork.php(162): PoolCounterWorkViaCallback->doWork()
#6 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(342): PoolCounterWork->execute()
#7 /srv/mediawiki/w/extensions/EmbedVideo/includes/Media/AudioHandler.php(278): MediaWiki\Extension\EmbedVideo\Media\AudioHandler->getMakeProbeFromPool(FSFile)
#8 /srv/mediawiki/w/includes/media/MediaHandler.php(236): MediaWiki\Extension\EmbedVideo\Media\AudioHandler->getMetadata(FSFile, string)
#9 /srv/mediawiki/w/includes/utils/MWFileProps.php(88): MediaHandler->getSizeAndMetadataWithFallback(FSFile, string)
#10 /srv/mediawiki/w/includes/upload/UploadBase.php(552): MWFileProps->getPropsFromPath(string, string)
#11 /srv/mediawiki/w/includes/upload/UploadBase.php(485): UploadBase->verifyPartialFile()
#12 /srv/mediawiki/w/includes/upload/UploadBase.php(391): UploadBase->verifyFile()
#13 /srv/mediawiki/w/includes/upload/UploadFromFile.php(95): UploadBase->verifyUpload()
#14 /srv/mediawiki/w/includes/specials/SpecialUpload.php(550): UploadFromFile->verifyUpload()
#15 /srv/mediawiki/w/includes/specials/SpecialUpload.php(244): SpecialUpload->processUpload()
#16 /srv/mediawiki/w/includes/specialpage/SpecialPage.php(647): SpecialUpload->execute(NULL)
#17 /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php(1366): SpecialPage->run(NULL)
#18 /srv/mediawiki/w/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#19 /srv/mediawiki/w/includes/MediaWiki.php(925): MediaWiki->performRequest()
#20 /srv/mediawiki/w/includes/MediaWiki.php(559): MediaWiki->main()
#21 /srv/mediawiki/w/index.php(53): MediaWiki->run()
#22 /srv/mediawiki/w/index.php(46): wfIndexMain()
#23 {main}

@octfx
Copy link
Member

octfx commented Dec 6, 2021

@Universal-Omega thanks for this!

The mentioned commit indeed had another error... 🙄
Commit 4e01482 handles the case when a FSFile is present. This should fix the upload problem

As for the FFProbe::invokeFFProbe I think that too should be fixed by this

@alistair3149
Copy link
Collaborator

Seems to be fixed. Closing this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants