Skip to content
This repository has been archived by the owner on Jun 10, 2019. It is now read-only.

Improper escaping #408

Open
drts01 opened this issue Nov 16, 2017 · 3 comments
Open

Improper escaping #408

drts01 opened this issue Nov 16, 2017 · 3 comments
Labels

Comments

@drts01
Copy link
Contributor

drts01 commented Nov 16, 2017

When trying to run the docker example mentioned in the readme, bootstrap-vz throws an error Error response from daemon: ' is not a valid change command. I believe this is a string escaping issue. I ran it again with --pause-on-error and cut and pasted the command (tar | docker import) it worked. I tried from commit 38fc7c5 and version 0.9.11, both have this issue.

(venv) root@debootstrap:~# bootstrap-vz bootstrap-vz/manifests/examples/docker/jessie-minimized.yml
Generating tasklist
Adding commands required for docker
Adding commands required for bootstrapping Debian
Checking availability of external commands
Creating the Dockerfile entry
Initializing the bootstrapping filter list
Creating workspace
Adding default release sources
Adding packages from the manifest
Creating volume folder
Creating /etc/dpkg/dpkg.cfg.d before bootstrapping
Configuring dpkg and debootstrap to not install additional documentation for packages
Configuring dpkg and debootstrap to only include specific locales/manpages when installing packages
Creating the bootstrapping locales filter script
Installing Debian
Copying mtab from host system
Mounting folders for writing temporary and cache data
Configuring apt to always gzip lists files
Configuring apt to remove suggested packages when autoremoving
Writing aptitude sources to disk
Configuring apt to only download and use specific translation files
Disabling daemon autostart
Configuring apt to always clean everything out when it's done
Updating the package cache
Upgrading packages and fixing broken dependencies
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:",
LC_ALL = (unset),
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: delaying package configuration, since apt-utils is not installed
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
debconf: unable to initialize frontend: Dialog
debconf: (No usable dialog-like program is installed, so the dialog based frontend cannot be used. at /usr/share/perl5/Debconf/FrontEnd/Dialog.pm line 76.)
debconf: falling back to frontend: Readline
debconf: unable to initialize frontend: Readline
debconf: (Can't locate Term/ReadLine.pm in @INC (you may need to install the Term::ReadLine module) (@INC contains: /etc/perl /usr/local/lib/x86_64-linux-gnu/perl/5.20.2 /usr/local/share/perl/5.20.2 /usr/lib/x86_64-linux-gnu/perl5/5.20 /usr/share/perl5 /usr/lib/x86_64-linux-gnu/perl/5.20 /usr/share/perl/5.20 /usr/local/lib/site_perl .) at /usr/share/perl5/Debconf/FrontEnd/Readline.pm line 7.)
debconf: falling back to frontend: Teletype

Current default time zone: 'Etc/UTC'
Local time is now:      Thu Nov 16 07:43:29 UTC 2017.
Universal Time is now:  Thu Nov 16 07:43:29 UTC 2017.
Run 'dpkg-reconfigure tzdata' if you wish to change it.

Installing packages
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US:",
LC_ALL = (unset),
LANG = "en_US"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
debconf: delaying package configuration, since apt-utils is not installed
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)
Setting the selected timezone
Enabling shadowconfig
Setting the selected local timezone (copy)
Removing temporary files
Removing unused packages
Clearing the MOTD
Removing folder mounts for temporary and cache data
Clearing the aptitude cache
Removing mtab
Populating docker labels
Appending Dockerfile instructions from the manifest
Creating docker image
Error response from daemon: ' is not a valid change command
tar: -: Wrote only 4096 of 10240 bytes
tar: Error is not recoverable: exiting now
Command 'tar --create --numeric-owner --directory /target/50b700ec/root . | docker import --change 'LABEL distribution-scope=public' --change 'LABEL description='"'"'Minimized version of Debian jessie without any manpages, additional documentation or other language files. Additional package installs: inetutils-ping (dep: netbase) and iproute2
'"'"'' --change 'LABEL summary='"'"'Debian jessie amd64'"'"'' --change 'LABEL architecture=amd64' --change 'LABEL build-date=2017-11-16T07:43:33Z' --change 'LABEL name=debian-jessie-amd64:latest' --change 'CMD /bin/bash' - debian-jessie-amd64:latest' returned non-zero exit status 1
Traceback (most recent call last):
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/base/main.py", line 111, in run
    tasklist.run(info=bootstrap_info, dry_run=dry_run)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/base/tasklist.py", line 44, in run
    task.run(info)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/providers/docker/tasks/image.py", line 29, in run
    [info._docker['image_id']] = log_check_call([cmd], shell=True)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/common/tools.py", line 13, in log_check_call
    raise e
CalledProcessError: Command 'tar --create --numeric-owner --directory /target/50b700ec/root . | docker import --change 'LABEL distribution-scope=public' --change 'LABEL description='"'"'Minimized version of Debian jessie without any manpages, additional documentation or other language files. Additional package installs: inetutils-ping (dep: netbase) and iproute2
'"'"'' --change 'LABEL summary='"'"'Debian jessie amd64'"'"'' --change 'LABEL architecture=amd64' --change 'LABEL build-date=2017-11-16T07:43:33Z' --change 'LABEL name=debian-jessie-amd64:latest' --change 'CMD /bin/bash' - debian-jessie-amd64:latest' returned non-zero exit status 1
Rolling back
Deleting the bootstrapping locales filter script
Deleting volume folder
Deleting workspace
Successfully completed rollback
Traceback (most recent call last):
  File "/root/bootstrap-vz/venv/bin/bootstrap-vz", line 11, in <module>
    sys.exit(main())
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/base/main.py", line 29, in main
    dry_run=opts['--dry-run'])
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/base/main.py", line 111, in run
    tasklist.run(info=bootstrap_info, dry_run=dry_run)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/base/tasklist.py", line 44, in run
    task.run(info)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/providers/docker/tasks/image.py", line 29, in run
    [info._docker['image_id']] = log_check_call([cmd], shell=True)
  File "/root/bootstrap-vz/venv/local/lib/python2.7/site-packages/bootstrapvz/common/tools.py", line 13, in log_check_call
    raise e
subprocess.CalledProcessError: Command 'tar --create --numeric-owner --directory /target/50b700ec/root . | docker import --change 'LABEL distribution-scope=public' --change 'LABEL description='"'"'Minimized version of Debian jessie without any manpages, additional documentation or other language files. Additional package installs: inetutils-ping (dep: netbase) and iproute2
'"'"'' --change 'LABEL summary='"'"'Debian jessie amd64'"'"'' --change 'LABEL architecture=amd64' --change 'LABEL build-date=2017-11-16T07:43:33Z' --change 'LABEL name=debian-jessie-amd64:latest' --change 'CMD /bin/bash' - debian-jessie-amd64:latest' returned non-zero exit status 1
@andsens andsens added the bug label Nov 16, 2017
@drts01
Copy link
Contributor Author

drts01 commented Nov 21, 2017

Is this related to #373 ?

@drts01
Copy link
Contributor Author

drts01 commented Feb 9, 2018

This was not an escaping issues, it was a trailing new line in the example manifest. I submitted a PR, #454, to update the manifest.

I am not sure if this is a bug. But I am not closing this issue yet as I am not sure if trimming whitespace is the better solution.

@andsens
Copy link
Owner

andsens commented Feb 10, 2018

Escaping that description is way too tricky for my liking. This should be simple damnit!
FYI, that code has been through 3 iterations:
5dada60#diff-089949bb1887ff2053d0d0bfa3cfc61bR46
49ddd38#diff-089949bb1887ff2053d0d0bfa3cfc61bR61
eca54d6#diff-089949bb1887ff2053d0d0bfa3cfc61bR55

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants