Skip to content

Commit

Permalink
Fix error caused by tabs in ENV
Browse files Browse the repository at this point in the history
This commit replace '\t' with '\\t' in the ENV command. This will allow
'export VAR=VAL' works properly when VAL contains '\t'.

Fixes tern-tools#812.

Signed-off-by: WangJL <hazard15020@gmail.com>
  • Loading branch information
ForgetMe17 committed Sep 25, 2020
1 parent d561fce commit 6d75b2e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tern/analyze/docker/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,7 @@ def get_env_vars(image_obj):
'''Given a docker image object, return the list of environment variables,
if any, based on their values in the config.'''
config = image_obj.get_image_config(image_obj.get_image_manifest())
# replace '\t' with '\\t' in the ENV
for idx, env_str in enumerate(config['config']['Env']):
config['config']['Env'][idx] = env_str.replace('\t', '\\t')
return config['config']['Env']

0 comments on commit 6d75b2e

Please sign in to comment.