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

fix: Quote file paths in calls to ffmpeg #132

Closed
wants to merge 8 commits into from

Conversation

PeterC89
Copy link
Contributor

@PeterC89 PeterC89 commented Feb 2, 2024

About Me

The pull request is posted on behalf of the BBC.

Type of Contribution

This is a: Bug fix

Current Behavior

File paths with spaces in break ffmpeg calls

New Behavior

File paths are enclosed in quotes (think I got them all)
File paths are escaped depending on platform

Testing Instructions

Other Information

Fixes #131

Status

  • PR is ready to be reviewed.
  • The functionality has been tested by the author.
  • Relevant unit tests has been added / updated.
  • Relevant documentation (code comments, system documentation) has been added / updated.

@Julusian
Copy link
Member

Julusian commented Feb 2, 2024

This needs some testing on linux, I am pretty sure that we have just removed the quotes because having them was an issue on linux #86

@nytamin nytamin requested review from nytamin and Julusian February 2, 2024 14:45
@nytamin
Copy link
Contributor

nytamin commented Feb 2, 2024

I did a local test in Windows to verify that this fix works there. All good.
We'll wait for a test in Linux before merging.

@Julusian
Copy link
Member

Julusian commented Feb 2, 2024

@single-app/app: {"label":"AppContainer","level":"warn","message":"App \"appContainer0_0\" (worker): [WorkerAgent] Worker \"appContainer0_0\" stopped job 1, (8f5796ea6bea0e7381c17c8f781e55a483d507c2_preview), due to error: (0): Error: Command failed: ffprobe -hide_banner -i \"/home/julus/Projects/package_manager_test/target/WIPE.mov\" -show_streams -show_format -print_format json\n\"/home/julus/Projects/package_manager_test/target/WIPE.mov\": No such file or directory\n, Error: Command failed: ffprobe -hide_banner -i \"/home/julus/Projects/package_manager_test/target/WIPE.mov\" -show_streams -show_format -print_format json\n\"/home/julus/Projects/package_manager_test/target/WIPE.mov\": No such file or directory\n\n    at ChildProcess.exithandler (node:child_process:422:12)\n    at ChildProcess.emit (node:events:517:28)\n    at maybeClose (node:internal/child_process:1098:16)\n    at ChildProcess._handle.onexit (node:internal/child_process:303:5)","timestamp":"2024-02-02T15:11:14.070Z"}

or reformatted:

Error: Command failed: ffprobe -hide_banner -i "/home/julus/Projects/package_manager_test/target/WIPE.mov" -show_streams -show_format -print_format json
"/home/julus/Projects/package_manager_test/target/WIPE.mov": No such file or directory
    at ChildProcess.exithandler (node:child_process:422:12)
    at ChildProcess.emit (node:events:517:28)
    at maybeClose (node:internal/child_process:1098:16)
    at ChildProcess._handle.onexit (node:internal/child_process:303:5)

@Julusian
Copy link
Member

Julusian commented Feb 2, 2024

Without this change, using files with spaces works fine on linux.

Interestingly, with this change the file does get copied correctly still, but any calls with ffmpeg appear to fail

@PeterC89
Copy link
Contributor Author

PeterC89 commented Feb 2, 2024

@Julusian @nytamin Changed it so quotes are only added on Windows

@Julusian
Copy link
Member

Julusian commented Feb 2, 2024

@PeterC89 could you put that into a helper function, to make it less duplicated and clearer as to why it is done.

I am currently working on writing a couple of basic unit tests which will help guard against this, and I've found another couple of cases of issues with quotes

@PeterC89
Copy link
Contributor Author

PeterC89 commented Feb 2, 2024

@Julusian Done, I've also made it so it escapes spaces on non-Windows platforms with a \ but I'm not sure if that will break things?

@Julusian
Copy link
Member

Julusian commented Feb 2, 2024

No linux doesn't appear to like that.
I've finished writing my tests, if you rebase onto #133 then the tests in github actions will be able to tell you if everything works.
That branch currently has a lot of errors on windows, because of the bug you have found

@PeterC89 PeterC89 force-pushed the fix/quoteFilePaths branch 3 times, most recently from 36e41a6 to 24f47e3 Compare February 10, 2024 10:40
@PeterC89
Copy link
Contributor Author

PeterC89 commented Feb 10, 2024

@Julusian @nytamin This PR is probably ready now having gotten some time to track down the last unquoted calls including some in the Atem accessor

@Julusian
Copy link
Member

Thanks!
I've had to manually merge this 6625790 as I wanted to squash my changes which this was based on (I should have done that squash earlier)

@PeterC89
Copy link
Contributor Author

Thanks @Julusian
Unfortunately this still appears to be broken on the live system.
Would you be able to do a build please just to make sure I'm not doing something daft on my local build?

@Julusian
Copy link
Member

Maybe @nytamin can help with that?
I'm not setup to run package manager on windows

@PeterC89 PeterC89 deleted the fix/quoteFilePaths branch September 10, 2024 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants