#1061148 apt: option -a has several meanings and is unusable

Package:
apt
Source:
apt
Description:
commandline package manager
Submitter:
Vincent Lefevre
Date:
2024-01-26 11:33:02 UTC
Severity:
normal
#1061148#5
Date:
2024-01-19 14:43:25 UTC
From:
To:
In the apt-get(8) man page:

       apt-get [-asqdyfmubV] [-o=config_string] [-c=config_file]
               [-t=target_release] [-a=architecture] {update | upgrade |
               dselect-upgrade | dist-upgrade |
               install pkg [{=pkg_version_number | /target_release}]...  |
               remove pkg...  | purge pkg...  |
               source pkg [{=pkg_version_number | /target_release}]...  |
               build-dep pkg [{=pkg_version_number | /target_release}]...  |
               download pkg [{=pkg_version_number | /target_release}]...  |
               check | clean | autoclean | autoremove | {-v | --version} |
               {-h | --help}}

So option -a appears both as a single option -a and as -a=architecture.

In the apt(8) man page, only the second form is listed, but for both
commands, it is unusable:

# apt-get -a=i386 install libfontconfig-dev
E: Command line option 'a' [from -a=i386] is not understood in combination with the other options.

# apt -a=i386 install libfontconfig-dev
E: Command line option 'a' [from -a=i386] is not understood in combination with the other options.

#1061148#10
Date:
2024-01-19 15:43:24 UTC
From:
To:

#1061148#15
Date:
2024-01-19 16:10:40 UTC
From:
To:
Perhaps this should be explicitly documented. And the error message
should be clarified (note: "install" is a command, not an option).

OK, but I was looking at an option to install several packages
(package list to be copy-pasted) for a foreign architecture
without much typing.

The -a=... version is not documented in the manual, only -a alone,
but even for that, I don't understand the manual; the grammar seems
incorrect:

       -a, --host-architecture
           This option controls the architecture packages are built for by
           apt-get source --compile and how cross-builddependencies are
           satisfied. By default is it not set which means that the host
           architecture is the same as the build architecture (which is
           defined by APT::Architecture). Configuration Item:
           APT::Get::Host-Architecture.

There are 2 verbs "controls" and "are built". And I don't see how
to parse "for by". In the next sentence: "is it". Should this be
"it is"? The comma is missing before "which". Still, I don't see
what this option does.

#1061148#20
Date:
2024-01-19 16:47:40 UTC
From:
To:
apt-get source --compile compiles packages. For cross-compilation,
you need to set the host architecture. This option controls that.

And yes this is just runaway without punctuation, but uh wording
is hard and we really just want to rewrite all manual pages from
scratch.

Then you'll see -a, --host-architecture in the apt-build-dep
and apt-source and apt-satisfy manual pages (maybe they are all
the same, who knows).

#1061148#25
Date:
2024-01-19 17:38:06 UTC
From:
To:
Compare -t, which also doesn't say -t=foo. Probably mostly due to -t foo
working as well or just because the manpages like their inconsistencies
and would deserve some love, but who has the time to not just complain
but also actually write all of it…


(reordered for posterity)

A package is "built for" the given (with -a) host architecture by
"apt-get source --compile" – aka its instructed to cross-compile
a package for the given host architecture instead of doing a "normal"
compile where host and build architecture are the same.

So, "apt-get source -b -a armhf foo" will (simplified) build a
"foo_armhf.deb" on your (likely amd64) machine to be used on another
(probably less powerful) armhf machine. Similar for build-dep, just
that this won't build anything but interprets certain dependencies
differently.

Using the option properly requires preparations that would fill their
own manpage to explain properly and its certainly not APTs place to do
that as it is just a tiny cog in the cross-machinery.
don't need it, so you don't.

Perhaps it should, "is it not" has the hint of a question. In German
I would write such a sentence without a comma as the added phrase isn't
[that] optional, but not sure if a German – or English – teacher would
actually agree on me claiming "definition phrase", which are not
separated by commas in both languages. Could easily be done without
a which if we were really trying.

Doesn't matter that much through as I would agree that the manpage(s)
need a revamp, but certainly not by me and not based on this. For this
specific option in particular, 99% of the user base are probably better
served if we were to remove its documentation entirely.

What about the 1%? Well, they deserve to write the patches to improve
the manpage and potentially fixup the translations (depending on how
much they reword here).

[Case in point, the option as documented doesn't work for years and
 nobody noticed – because 1% was an overstatement already; fixed in git]


Best regards

David Kalnischkies

#1061148#30
Date:
2024-01-26 11:29:04 UTC
From:
To:
This is not the same thing. The -t option is listed only with an
argument, while there is a -a option *without* an argument:

  apt-get [-asqdyfmubV] ... [-a=architecture] ...
            ^ here

Perhaps this is a mistake...

OK, it took me some time to find how this sentence should be parsed.
In particular, I thought that this description was for the -a version
without an argument (see above), and the sentence couldn't have any
sense as a consequence.

BTW, in the option listing, whether an option takes an argument is
generally indicated. For instance, in the cp man page:

       -S, --suffix=SUFFIX
              override the usual backup suffix

And simpler sentences would be easier to understand, with the context
given first. For instance, something like

      With "apt-get source --compile", packages are built for the
      given architecture instead of [...]

Or more explicitly:

    -a, --host-architecture=ARCH
      With "apt-get source --compile", packages are built for
      architecture ARCH instead of [...]

If build-dep is also concerned by this option, this should be said.

Here, "which means..." relates to an entire statement ("it is not set"),
so that a comma is needed. See

https://guinlist.wordpress.com/tag/clause-referring-which/

"2. Relating to an Entire Statement
[...]
(c) Octavian defeated his enemies in battle, which enabled him to
become Roman Emperor.

/Which/ here refers to what /Octavian/ did, not the /battle/.

In this usage, /which/ is always needed instead of /who/ or /that/, it
always follows a comma, and it has a singular verb after it. [...]"
^^^^^^^^^^^^^^^^^^^^^^

Or this (in French):

https://www.anglaisfacile.com/exercices/exercice-anglais-2/exercice-anglais-26463.php

(this is the case where "which" is translated in French by "ce que"
or "ce qui", instead of just "que" or "qui" when "which" relates to
a noun).