"//" at beginning of YAML file path when error in network config found
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Netplan |
Fix Released
|
Medium
|
Eric Desrochers | ||
netplan.io (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Bionic |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
[Impact]
When performing "netplan try" or "netplan apply" on a network configuration with errors, netplan error out a message as follow :
$ netplan try
-------
Error in network definition //etc/netplan/
An error occured: the configuration could not be generated
-------
$ netplan apply
-------
Error in network definition //etc/netplan/
-------
[Explanation]
While debugging the situation a little more I found out that it seems to come from here:
# src/generate.c
-------
g_autofree char* glob_etc = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/etc/netplan/
g_autofree char* glob_run = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/run/netplan/
g_autofree char* glob_lib = g_strjoin(NULL, rootdir ?: "", G_DIR_SEPARATOR_S, "/lib/netplan/
-------
To prove my theory, as a debug exercise, I have modified netplan code to g_fprint() the variable when the above commands are executed:
$ netplan apply
-------
glob_etc:
glob_run:
glob_lib:
Error in network definition //etc/netplan/
-------
$ netplan try
-------
glob_etc:
glob_run:
glob_lib:
Error in network definition //etc/netplan/
An error occured: the configuration could not be generated
-------
Further more investigation revealed that the double slash "//" is added by the combination of G_DIR_SEPARATOR_S "/" and "/etc/netplan/
# netplan try
-------
rootdir:(null)
G_DIR_SEPARATOR_S:/
glob_etc:
Error in network definition //etc/netplan/
An error occured: the configuration could not be generated
-------
[Test Case]
1) Have netplan installed & configured
2) Do a typo in your network definition on purpose (above situation I change "version" for "xversion" to force the error to be displayed
3) Perform "netplan try" and/or "netplan apply"
The following output will be displayed:
"Error in network definition //etc/netplan/
Ideally the output should look like this :
"Error in network definition /etc/netplan/
With only 1 "/" instead of 2 "//".
[Regression Potential]
Regression low.
For some reasons it seems like multiples slashes can be handle without problem. Functionality-wise, nothing will be change. Simply that the file path will be treated with only 1 "/".
Example:
$ ls -altr /////////tmp/test
-rwxr-xr-x 1 user group 8392 May 15 18:14 /////////tmp/test
$ ls -altr /tmp/test
-rwxr-xr-x 1 user group 8392 May 15 18:14 /tmp/test
[Other info]
https:/
https:/
description: | updated |
description: | updated |
description: | updated |
description: | updated |
description: | updated |
Changed in netplan: | |
assignee: | nobody → Eric Desrochers (slashd) |
description: | updated |
description: | updated |
description: | updated |
Changed in netplan: | |
status: | New → In Progress |
Changed in netplan: | |
status: | In Progress → Fix Committed |
Changed in netplan.io (Ubuntu): | |
status: | New → In Progress |
importance: | Undecided → Medium |
status: | In Progress → Triaged |
Changed in netplan: | |
importance: | Undecided → Medium |
Changed in netplan: | |
status: | Fix Committed → Fix Released |
Changed in netplan.io (Ubuntu Bionic): | |
status: | Fix Released → Fix Committed |
Upstream PR : /github. com/CanonicalLt d/netplan/ pull/30
https:/