@@ -388,7 +388,7 @@ generate_enter_command()
388388 --user=root"
389389 else
390390 result_command=" ${result_command}
391- --user ${USER} "
391+ --user= ${USER} "
392392 fi
393393
394394 # For some usage, like use in service, or launched by non-terminal
@@ -421,11 +421,11 @@ generate_enter_command()
421421 fi
422422
423423 result_command=" ${result_command}
424- --workdir ${workdir} "
424+ --workdir= ${workdir} "
425425 result_command=" ${result_command}
426- --env CONTAINER_ID=${container_name} "
426+ --env= CONTAINER_ID=${container_name} "
427427 result_command=" ${result_command}
428- --env DISTROBOX_ENTER_PATH=${distrobox_enter_path} "
428+ --env= DISTROBOX_ENTER_PATH=${distrobox_enter_path} "
429429
430430 # Loop through all the environment vars
431431 # and export them to the container.
@@ -438,7 +438,7 @@ generate_enter_command()
438438 # We also NEED to ignore the HOME variable, as this is set at create time
439439 # and needs to stay that way to use custom home dirs.
440440 result_command=" ${result_command}
441- --env ${i} "
441+ --env= ${i} "
442442 done
443443
444444 # Start with the $PATH set in the container's config
@@ -476,7 +476,7 @@ generate_enter_command()
476476 fi
477477
478478 result_command=" ${result_command}
479- --env PATH=${container_paths} "
479+ --env= PATH=${container_paths} "
480480
481481 # Ensure the standard FHS program paths are in XDG_DATA_DIRS environment
482482 standard_paths=" /usr/local/share /usr/share"
@@ -491,16 +491,16 @@ generate_enter_command()
491491 fi
492492 done
493493 result_command=" ${result_command}
494- --env XDG_DATA_DIRS=${container_paths} "
494+ --env= XDG_DATA_DIRS=${container_paths} "
495495
496496 # This correctly sets the XDG_* dirs to the container_home
497497 # it will be $HOME if using regular home dirs
498498 # if will be $container_home if using a custom home during create
499499 result_command=" ${result_command}
500- --env XDG_CACHE_HOME=${container_home} /.cache
501- --env XDG_CONFIG_HOME=${container_home} /.config
502- --env XDG_DATA_HOME=${container_home} /.local/share
503- --env XDG_STATE_HOME=${container_home} /.local/state"
500+ --env= XDG_CACHE_HOME=${container_home} /.cache
501+ --env= XDG_CONFIG_HOME=${container_home} /.config
502+ --env= XDG_DATA_HOME=${container_home} /.local/share
503+ --env= XDG_STATE_HOME=${container_home} /.local/state"
504504
505505 # Ensure the standard FHS program paths are in XDG_CONFIG_DIRS environment
506506 standard_paths=" /etc/xdg"
@@ -515,18 +515,21 @@ generate_enter_command()
515515 fi
516516 done
517517 result_command=" ${result_command}
518- --env XDG_CONFIG_DIRS=${container_paths} "
518+ --env= XDG_CONFIG_DIRS=${container_paths} "
519519
520520 # re-enable logging if it was enabled previously.
521521 if [ " ${verbose} " -ne 0 ]; then
522522 set -o xtrace
523523 fi
524524
525525 # Add additional flags
526- if [ -n " ${container_manager_additional_flags} " ]; then
526+ IFS='
527+ '
528+ for flag in ${container_manager_additional_flags} ; do
529+ # ensure the flag name is separated from the value with an '=' (not a ' ')
527530 result_command=" ${result_command}
528- ${container_manager_additional_flags} "
529- fi
531+ $( echo " ${flag} " | sed -e ' s,^\( *[^= ]*\)[= ],\1=, ' ) "
532+ done
530533
531534 # Run selected container with specified command.
532535 result_command=" ${result_command}
@@ -715,11 +718,7 @@ cmd="$(generate_enter_command | tac)"
715718IFS='
716719'
717720for arg in ${cmd} ; do
718- if echo " ${arg} " | grep -q " " ; then
719- set - " $( echo " ${arg} " | cut -d' ' -f1) " " $( echo " ${arg} " | cut -d' ' -f2-) " " $@ "
720- else
721- set - " ${arg} " " $@ "
722- fi
721+ set - " ${arg} " " $@ "
723722done
724723
725724# Prepend the container manager command
0 commit comments