Keep the working directory off the CLI wrapper's search paths

Neither LD_LIBRARY_PATH nor PYTHONPATH is set in the base image, so
appending them unconditionally left a trailing ':'. An empty entry in a
colon-separated search path means the working directory, and Python
resolved it to /dsc on sys.path. Append the separator only when the
variable is already non-empty.

Reported by the automated review on #11.
This commit is contained in:
Maxim Shulga committed 2026-08-02 15:55:55 -07:00
1 parent 523a0955c4
commit c558caba5b
1 file changed
+3 -3
+3 -3
View File
@@ -29,9 +29,9 @@ RUN curl -fsSL -o /tmp/seaf-cli.AppImage "$SEAFILE_CLI_URL" && \
RUN printf '%s\n' \ RUN printf '%s\n' \
'#!/bin/sh' \ '#!/bin/sh' \
'APPDIR=/opt/seafile-cli' \ 'APPDIR=/opt/seafile-cli' \
'export PATH="$APPDIR/usr/bin:$PATH"' \ 'export PATH="$APPDIR/usr/bin${PATH:+:$PATH}"' \
'export LD_LIBRARY_PATH="$APPDIR/usr/lib:$LD_LIBRARY_PATH"' \ 'export LD_LIBRARY_PATH="$APPDIR/usr/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"' \
'export PYTHONPATH="$APPDIR/usr/lib/python3.9/site-packages:$PYTHONPATH"' \ 'export PYTHONPATH="$APPDIR/usr/lib/python3.9/site-packages${PYTHONPATH:+:$PYTHONPATH}"' \
'exec python3 "$APPDIR/usr/bin/seaf-cli" "$@"' \ 'exec python3 "$APPDIR/usr/bin/seaf-cli" "$@"' \
> /usr/local/bin/seaf-cli && \ > /usr/local/bin/seaf-cli && \
chmod +x /usr/local/bin/seaf-cli chmod +x /usr/local/bin/seaf-cli