[lxc-devel] [lxc/lxc] b275ef: More accurate error msg for template file

GitHub noreply at github.com
Tue Jan 29 12:06:24 UTC 2019


  Branch: refs/heads/master
  Home:   https://github.com/lxc/lxc
  Commit: b275efe319f10a35659543bb2743a1806a7ede3c
      https://github.com/lxc/lxc/commit/b275efe319f10a35659543bb2743a1806a7ede3c
  Author: Rachid Koucha <47061324+Rachid-Koucha at users.noreply.github.com>
  Date:   2019-01-29 (Tue, 29 Jan 2019)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  More accurate error msg for template file

When calling lxc-create, if the template exists but is not executable, we end with the following error messages which make believe that the template file does not exist when it is merely a execute access problem:

lxc-create: ctn00: utils.c: get_template_path: 918 No such file or directory - bad template: /.../lxc-busybox
lxc-create: ctn00: lxccontainer.c: do_lxcapi_create: 1786 Unknown template "/.../lxc-busybox"
lxc-create: ctn00: tools/lxc_create.c: main: 327 Failed to create container ctn00

Actually internally the errno is lost as the following code triggers a useless access to (strace output):

access("/.../lxc-busybox", X_OK) = -1 ENOENT (No such file or directory)

With the above fix, we get a more explicit error message when the template file is missing the "execute" bit:

lxc-create: bbc: utils.c: get_template_path: 917 Permission denied - Bad template pathname: /tmp/azerty
lxc-create: bbc: lxccontainer.c: do_lxcapi_create: 1816 Unknown template "/tmp/azerty"
lxc-create: bbc: tools/lxc_create.c: main: 331 Failed to create container bbc

With the above fix, we get a more explicit error message when the pathname of the template file is incorrect:

lxc-create: bbc: utils.c: get_template_path: 917 No such file or directory - Bad template pathname: /tmp/qwerty
lxc-create: bbc: lxccontainer.c: do_lxcapi_create: 1816 Unknown template "/tmp/qwerty"
lxc-create: bbc: tools/lxc_create.c: main: 331 Failed to create container bbc

Signed-off-by: Rachid Koucha <rachid.koucha at gmail.com>


  Commit: 9fc6fd210786d48df4a1950c2ce45f66d70f2114
      https://github.com/lxc/lxc/commit/9fc6fd210786d48df4a1950c2ce45f66d70f2114
  Author: Christian Brauner <christian at brauner.io>
  Date:   2019-01-29 (Tue, 29 Jan 2019)

  Changed paths:
    M src/lxc/utils.c

  Log Message:
  -----------
  Merge pull request #2817 from Rachid-Koucha/patch-5

More accurate error msg for template file


Compare: https://github.com/lxc/lxc/compare/dea31fe2c5fc...9fc6fd210786
      **NOTE:** GitHub Services has been marked for deprecation: https://developer.github.com/changes/2018-04-25-github-services-deprecation/

      We will provide an alternative path for the email notifications by January 31st, 2019.


More information about the lxc-devel mailing list