Skip to content

Fix '.format()' issue with 'find' {} placeholder (double braces addition), escaped slash and reordering of arguments#104

Merged
pbuncic merged 5 commits into
bitsorg:mainfrom
m-fol:main
Jul 21, 2026
Merged

Fix '.format()' issue with 'find' {} placeholder (double braces addition), escaped slash and reordering of arguments#104
pbuncic merged 5 commits into
bitsorg:mainfrom
m-fol:main

Conversation

@m-fol

@m-fol m-fol commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

In sync.py (fetch_symlinks), Python's .format() interprets {} as a placeholder and tries to replace it with a positional argument at index 0. This causes the command string to be processed incorrectly before reaching bash.
The braces are intended for find, where {} instead should be replaced on runtime by the returned path. Suggested solution is to add double braces to find.

The escaping for the -exec action leads to error. By putting \ in bash, the slash is escaped, leading to the semicolon not being escaped. Suggested solution here is updating \\; to \;

Warning appears regarding the order of the arguments. Order should be updated with the logic that -mindepth and -maxdepth should be before ! and before -type.

Final solution:

-     find "{remote_store}/{cvmfs_architecture}/Packages/{package}/$full_version" ! -name etc -maxdepth 1 -mindepth 1 -exec ln -sf {} "{workDir}/INSTALLROOT/$pkg_hash/{architecture}/{package}/" \\;
+    find "{remote_store}/{cvmfs_architecture}/Packages/{package}/$full_version" -mindepth 1 -maxdepth 1 ! -name etc -exec ln -sf {{}} "{workDir}/INSTALLROOT/$pkg_hash/{architecture}/{package}/" \;

And:

-    for install_path in $(find "{remote_store}/{cvmfs_architecture}/Packages/{package}" -type d -mindepth 1 -maxdepth 1); do
+    for install_path in $(find "{remote_store}/{cvmfs_architecture}/Packages/{package}" -mindepth 1 -maxdepth 1 -type d); do

@pbuncic
pbuncic merged commit 5aeba3d into bitsorg:main Jul 21, 2026
12 checks passed
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.

2 participants