-
Notifications
You must be signed in to change notification settings - Fork 56
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
debian software package does not install from url when version contains a colon character #2666
Labels
Milestone
Comments
11 tasks
@Ruadhri17 We could live with a naive implementation for now rather than doing a full url encoding: file
fn sm_path(name: &str, version: &Option<String>, target_dir_path: impl AsRef<Path>) -> PathBuf {
let mut filename = name.to_string();
if let Some(version) = version {
filename.push('_');
filename.push_str(version.as_str());
}
target_dir_path.as_ref().join(sanitize_filename(&filename))
}
fn sanitize_filename(filename: &String) -> String {
// Replace special characters
// see https://github.com/thin-edge/thin-edge.io/issues/2666
filename.replace(":", "__")
} |
11 tasks
Implemented in #2683 See the system test included in the PR. A dummy package was included in the tests to test the exact scenario highlighted in this test:
|
QA has thoroughly checked the bug and here are the results:
|
11 tasks
This was referenced Mar 11, 2024
11 tasks
11 tasks
This was referenced Jul 17, 2024
Closed
11 tasks
21 tasks
20 tasks
11 tasks
11 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
The tedge-apt-plugin fails to install a software package from a URL (e.g. a package hosted in Cumulocity IoT) if the software version contains a colon in its name due to
apt-get install <file>
ignoring the<file>
argument if a colon is present.apt interprets the colon as the Epoch separator, so it seems that
apt-get install
silently ignores the given file and does not exit.The root cause is the fact that
tedge-apt-plugin
downloads the debian file from the given software url, and save the file using the path built from the name and version, e.g./tmp/{name}_{version}.deb
, and the filename is not sanitized to be compatible withapt/apt-get
.There is a similar issue found in another project:
Note
version
field of the software package definition in Cumulocity IoT astedge-apt-plugin
does a meta information validation and while throw an error (MetaDataMismatch
) if the given version from the cloud does not match the package's versionTo Reproduce
Create a software package in Cumulocity for vim
vim
2:8.2.2434-3+deb11u1
Install vim via the Cumulocity IoT Device Management Software page for the device under test
Inspect the software management logs on the device to see if the
apt-get install
command actually tried installing the package or not (see below for an example where it doesn't process the given package)Expected behavior
If the
tedge-apt-plugin
downloads the debian package from a given URL, then the temporary file created from the download should sanitize the version by substituting any unsupported characters.Finding an example spec seems to be difficult, but this post might be helpful:
It might be enough to just replace
:
with the URL encoded%3a
, but the results will have to be verified.Screenshots
The following shows the output when trying to install a debian package from file with a colon in it (notice that there are no errors displayed):
# apt install '/tmp/vim_2:8.2.2434-3+deb11u1.deb' Reading package lists... Done Building dependency tree... Done Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 39 not upgraded.
Renaming the file to replace the
:
with%3a
, is enough for apt-get to process the package (though the install is still failing, however this is just because the dependencies aren't installed, and installing from file does not pull in dependencies automatically.)Environment (please complete the following information):
Debian GNU/Linux 12 (bookworm)
Raspberry Pi 5 Model B Rev 1.0
Linux rpi5-d83addab8e9f 6.1.0-rpi4-rpi-2712 #1 SMP PREEMPT Debian 1:6.1.54-1+rpt2 (2023-10-05) aarch64 GNU/Linux
tedge 1.0.0-rc.2~297+geb93afc
Additional context
The text was updated successfully, but these errors were encountered: