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

docs: fix misleading example of setting an env variable for a single command #3680

Merged
merged 1 commit into from Jun 21, 2022
Merged

Conversation

muru
Copy link
Contributor

@muru muru commented Jun 20, 2022

- What I did

Fix a misleading example of setting an environment variable for a single command.

- How I did it

The DEBIAN_FRONTEND environment variable is used to control the interface by which debconf questions are presented to the user (see man 7 debconf). In DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y, the DEBIAN_FRONTEND environment variable is only set for the apt-get update command which does not ask debconf questions, and will not affect the apt-get install command where these questions are actually asked. It should be the other way around.

- How to verify it

The way environment variables work for single commands can be tested thus:

% foo=bar sh -c 'echo "$0: |$foo|"' first_shell && sh -c 'echo "$0: |$foo|"' second_shell
first_shell: |bar|
second_shell: ||
% sh -c 'echo "$0: |$foo|"' first_shell && foo=bar sh -c 'echo "$0: |$foo|"' second_shell
first_shell: ||
second_shell: |bar|
% (export foo=bar; sh -c 'echo "$0: |$foo|"' first_shell && sh -c 'echo "$0: |$foo|"' second_shell)    
first_shell: |bar|
second_shell: |bar|

(In the last example, I'm running the commands in a subshell to avoid affecting the environment of my current shell.)

- Description for the changelog
Fix misleading example of setting an environment variable for a single command

- A picture of a cute animal (not mandatory but encouraged)

image

@muru muru requested a review from thaJeztah as a code owner June 20, 2022 09:42
…command

The `DEBIAN_FRONTEND` environment variable is used to control the interface by which debconf questions are presented to the user (see [`man 7 debconf`][1]). In `DEBIAN_FRONTEND=noninteractive apt-get update && apt-get install -y`, the `DEBIAN_FRONTEND` environment variable is only set for the `apt-get update` command which does not ask debconf questions, and will not affect the `apt-get install` command where these questions are actually asked. It should be the other way around.

  [1]: https://manpages.debian.org/debconf.7.html

Signed-off-by: Murukesh Mohanan <murukesh.mohanan@gmail.com>
@codecov-commenter
Copy link

Codecov Report

Merging #3680 (7227c01) into master (c59773f) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##           master    #3680   +/-   ##
=======================================
  Coverage   59.01%   59.01%           
=======================================
  Files         289      289           
  Lines       24623    24623           
=======================================
  Hits        14532    14532           
  Misses       9218     9218           
  Partials      873      873           

Copy link
Member

@thaJeztah thaJeztah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

nice catch, thanks!

@thaJeztah thaJeztah merged commit ac1d1ad into docker:master Jun 21, 2022
@thaJeztah thaJeztah added this to the 22.06.0 milestone Jun 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants