datalad / datalad-next

DataLad extension for new functionality and improved user experience
https://datalad.org
Other
6 stars 7 forks source link

Consistent shell command quoting #690

Closed christian-monch closed 1 month ago

christian-monch commented 1 month ago

Fixes issue #661

This PR automatically quotes all path parameters provided as Path or PurePosixPath-instances to shell.posix-functions via shlex.quote.

Byte-parameter like the command-parameter of ShellCommandExecutor.__call__() are never quoted. The caller has to ensure that file names are properly quoted. The are a number of reasons for this policy:

  1. It is not clear which syntax is used by the shell-program, for example, it could be: bash, PowerShell, Python, etc.
  2. Even if the shell-program was known, e.g. bash, there is no way to generally determine whether a path is contained in the command-argument.
mih commented 1 month ago

The failure on windows seems to be real.

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 92.42%. Comparing base (37246b1) to head (5d5ee93).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #690 +/- ## ======================================= Coverage 92.41% 92.42% ======================================= Files 193 193 Lines 14108 14121 +13 Branches 2126 2128 +2 ======================================= + Hits 13038 13051 +13 Misses 808 808 Partials 262 262 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

christian-monch commented 1 month ago

The failure on windows seems to be real.

Yes, I overestimated the capabilities of FAT and NTFS. Everything should be fine now