#1021497 autopkgtest: Provide a way to escape # character in Test-Command

#1021497#5
Date:
2022-10-09 16:33:52 UTC
From:
To:
Dear Maintainer,

If I have such a line in the d/tests/control

Test-Command: modprobe --verbose --set-version "$(for kernel in /boot/config-
*;
do echo ${kernel#*-}; done | tail -n1)" my_kernel_module

It will consider the command is only

modprobe --verbose --set-version "$(for kernel in /boot/config-*; do echo
${kernel

Everything after '#' is ignored, as stated in [1]

Would you provide a way to escape it? I don't know how though...

For example in debhelper [2] to escape a $, they suggest ${Dollar}. Or for a
new line, they would do ${Newline}. So maybe something similar, like ${Hash}
or
${NumberSign}. But the use of the dollar sign, wouldn't be very optimal since
it already has a meaning in shell.

[1] https://salsa.debian.org/ci-team/autopkgtest/blob/master/doc/README.package-tests.rst
[2] https://manpages.debian.org/bullseye/debhelper/debhelper.7.en.html

For now, I put the command in a separate script called with "Command:"

#1021497#8
Date:
2026-09-21 11:47:18 UTC
From:
To:
Hello,

Bug #1021497 in autopkgtest reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/ci-team/autopkgtest/-/commit/347edb23c251bfd588ae02db77cfa617121a99cf
------------------------------------------------------------------------
testdesc: delegate parsing d/t/control comments to python-debian

Autopkgtest doing its own comment parsing was introduced as a workaround
for python-debian bug #743174, which got fixed in version 0.1.23 (2014).
We can safely drop the workaround, and delegate comments parsing to the
Deb822 parser from python-debian.

This also means that we now follow the standard deb822(5) rules for
comments, which is desirable, but the change can potentially make
autopkgtest fail on d/t/control files currently considered valid. In
practice, the change consists in the fact that that we now only allow
comment *lines*, i.e. lines starting with '#', e.g.

# this was a comment line; it still is
 # this was a comment line; it now stays literal
foo # this was an inline comment; it now stays literal

I did some some research on codesearch.debian.net to assess potential
fallout, and I found essentially none.

Closes: #1021497

# Please enter the commit message for your changes. Lines starting
# with '#' will be kept; you may remove them yourself if you want to.
# An empty message aborts the commit.
#
# Date:      Mon Sep 21 13:08:26 2026 +0200
#
# On branch paride/native-parse-rfc822
# Changes to be committed:
#	modified:   README.package-tests.rst
#	modified:   ../lib/testdesc.py
#	modified:   ../tests/testdesc
#
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1021497

#1021497#13
Date:
2026-09-21 11:48:09 UTC
From:
To:
Hello,

Bug #1021497 in autopkgtest reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/ci-team/autopkgtest/-/commit/ab606f992ef79a447cf35db284f5ea6918fdfcb7
------------------------------------------------------------------------
testdesc: delegate parsing d/t/control comments to python-debian

Autopkgtest doing its own comment parsing was introduced as a workaround
for python-debian bug #743174, which got fixed in version 0.1.23 (2014).
We can safely drop the workaround, and delegate comments parsing to the
Deb822 parser from python-debian.

This also means that we now follow the standard deb822(5) rules for
comments, which is desirable, but the change can potentially make
autopkgtest fail on d/t/control files currently considered valid. In
practice, the change consists in the fact that that we now only allow
comment *lines*, i.e. lines starting with '#', e.g.

# this was a comment line; it still is
 # this was a comment line; it now stays literal
foo # this was an inline comment; it now stays literal

I did some some research on codesearch.debian.net to assess potential
fallout, and I found essentially none.

Closes: #1021497
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1021497

#1021497#16
Date:
2026-09-21 12:22:12 UTC
From:
To:
Hello,

Bug #1021497 in autopkgtest reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/ci-team/autopkgtest/-/commit/f3c729333f11a01bad478f99150d32436c35716b
------------------------------------------------------------------------
testdesc: delegate parsing d/t/control comments to python-debian

Autopkgtest doing its own comment parsing was introduced as a workaround
for python-debian bug #743174, which got fixed in version 0.1.23 (2014).
We can safely drop the workaround, and delegate comments parsing to the
Deb822 parser from python-debian.

This also means that we now follow the standard deb822(5) rules for
comments, which is desirable, but the change can potentially make
autopkgtest fail on d/t/control files currently considered valid. In
practice, the change consists in the fact that that we now only allow
comment *lines*, i.e. lines starting with '#', e.g.

# this was a comment line; it still is
 # this was a comment line; it now stays literal
foo # this was an inline comment; it now stays literal

I did some some research on codesearch.debian.net to assess potential
fallout, and I found essentially none.

Closes: #1021497
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1021497

#1021497#19
Date:
2026-09-22 17:55:11 UTC
From:
To:
Hello,

Bug #1021497 in autopkgtest reported by you has been fixed in the
Git repository and is awaiting an upload. You can see the commit
message below and you can check the diff of the fix at:

https://salsa.debian.org/ci-team/autopkgtest/-/commit/f3c729333f11a01bad478f99150d32436c35716b
------------------------------------------------------------------------
testdesc: delegate parsing d/t/control comments to python-debian

Autopkgtest doing its own comment parsing was introduced as a workaround
for python-debian bug #743174, which got fixed in version 0.1.23 (2014).
We can safely drop the workaround, and delegate comments parsing to the
Deb822 parser from python-debian.

This also means that we now follow the standard deb822(5) rules for
comments, which is desirable, but the change can potentially make
autopkgtest fail on d/t/control files currently considered valid. In
practice, the change consists in the fact that that we now only allow
comment *lines*, i.e. lines starting with '#', e.g.

# this was a comment line; it still is
 # this was a comment line; it now stays literal
foo # this was an inline comment; it now stays literal

I did some some research on codesearch.debian.net to assess potential
fallout, and I found essentially none.

Closes: #1021497
------------------------------------------------------------------------

(this message was generated automatically)
-- 
Greetings

https://bugs.debian.org/1021497