Open UriHerrera opened 5 years ago
Is there a particular reason why cupt isn't merely ignoring these comments on those files?
Presumably because it does not recognise those as comments. Which, in turn, could be either due to the bug in the code, interpreting the format more strictly than other tools, or the format got extended without libcupt
taking notice.
May I ask you to attach the config file in question (/etc/apt/apt.conf.d/50apt-file.conf) ?
Sure. These are the contents of the file.
## This file is provided by apt-file(1) to download Contents
## files, which is used by apt-file for searching.
Acquire::IndexTargets {
deb::Contents-deb {
MetaKey "$(COMPONENT)/Contents-$(ARCHITECTURE)";
ShortDescription "Contents-$(ARCHITECTURE)";
Description "$(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Contents (deb)";
flatMetaKey "Contents-$(ARCHITECTURE)";
flatDescription "$(RELEASE) Contents (deb)";
PDiffs "true";
KeepCompressed "true";
};
# Download Contents for source files if there is a deb-src
# line
deb-src::Contents-dsc {
MetaKey "$(COMPONENT)/Contents-source";
ShortDescription "Contents-source";
Description "$(RELEASE)/$(COMPONENT) source Contents (dsc)";
flatMetaKey "Contents-source";
flatDescription "$(RELEASE) Contents (dsc)";
PDiffs "true";
KeepCompressed "true";
DefaultEnabled "false";
};
# Configuration for downloading Contents files for
# debian-installer packages (udebs).
deb::Contents-udeb {
MetaKey "$(COMPONENT)/Contents-udeb-$(ARCHITECTURE)";
ShortDescription "Contents-udeb-$(ARCHITECTURE)";
Description "$(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Contents (udeb)";
flatMetaKey "Contents-udeb-$(ARCHITECTURE)";
flatDescription "$(RELEASE) Contents (udeb)";
KeepCompressed "true";
PDiffs "true";
DefaultEnabled "false";
};
### FALLBACKS
deb::Contents-deb-legacy {
MetaKey "Contents-$(ARCHITECTURE)";
ShortDescription "Contents-$(ARCHITECTURE)";
Description "$(RELEASE) $(ARCHITECTURE) Contents (deb)";
PDiffs "true";
KeepCompressed "true";
Fallback-Of "Contents-deb";
Identifier "Contents-deb";
};
};
Dir::Etc::apt-file-main "apt-file.conf";
# Default for -I/--index-names (comma-separated)
apt-file::Index-Names "deb";
Thank you. It appears that I missed a moment when '#'-syntax was introduced.
Will be implemented.
Here (https://github.com/jackyf/cupt/blob/master/cpp/lib/src/internal/configparser.cpp#L246), only #
followed by whitespace are parsed as comments. I think everything starting with #
should be a comment.
I think everything starting with # should be a comment.
Not that simple, unfortunately. #clear
is not a comment although it starts with a #
. Still, ##
is possible to support.
The documentation for APT was updated to mention hash-style comments on 25 June 2021 with this edit.
I haven't yet found the changes that allowed hash style comments for APT. Even the updated APT documentation is not very accurate because as you state, some commands begin with a hash; so this apt documentation ought to be re-worded for accuracy.
Anyway, I'm here because I filed bugs against two other packages
https://github.com/nthykier/apt-file/issues/4 https://github.com/ximion/appstream/issues/409
thinking they had incorrect comments in their apt config files. I'm running Debian Bullseye whose apt version doesn't yet document the hash style comment but some of the packages use it (seemingly without issue) but whose cupt version complains about them when a "cupt why" command is issued.
Whenever I use
cupt
to install a package with it, it gives this error:After some troubleshooting, I found that unless I removed every comment from that configuration file, it would always display those messages. Is there a particular reason why
cupt
isn't merely ignoring these comments on those files?.