[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: reportbug: don't know: bug in apt [list] or in grep



Am Thu, Jan 19, 2023 at 11:40:50AM +0100 schrieb tomas@tuxteam.de:

Hello Tomas,

> On Thu, Jan 19, 2023 at 11:31:23AM +0100, Christoph Brinkhaus wrote:
> > Am Thu, Jan 19, 2023 at 09:10:30AM +0100 schrieb js-priv@online.de:
> > 
> > Hello Julian,
> > 
> > > Hello together,
> > > listing packages in apt with ”sudo“ in the title returns different output (bash commands at the end of the email). I would fill a bug report, but I'm not sure whether to address it to grep or apt. How do you see this?
> > > 
> > > Kind regards
> > > Julian Schreck
> > > --
> > > $ apt list sudo*   vs.  $ apt list | grep "^sudo[a-z-]"
> > > $ apt list *sudo   vs.  $ apt list | grep "[a-z-]sudo/"
> > > $ apt list *sudo*  vs.  $ apt list | grep "sudo"
> > 
> > It seems to be more a shell topic or how man 7 glob is handled.
> > Please try the first patterns with "" signs as
> > apt-list "sudo*" instead of apt-list sudo* and so on.
> > It made the difference for me using the fish shell.
> 
> Doing "apt list sudo*" without any quoting is asking for trouble anyway,
> regardless of the shell you use.

Yes, quoting is the correct term. And it is of superior improtance,
especially if the input is not perdefined in terms of the structure.
E.g. existance of special signs as the asterisk *, white spaces and so
on.
> 
> What the command apt will ultimately see will depend on what files are
> in your current directory.
 
For curiosity If have done a small test as below.
Unfortunately there are a few outputs in German. For this comparisons
the exact meanings of the German text has no importance at all.

1. The first command of the original poster:
chris@lenovo ~> apt list sudo*
fish: No matches for wildcard 'sudo*'. See `help expand`.
apt list sudo*
         ^
2. Create an empty file to see the effect:
chris@lenovo ~> touch sudo

3. The first command of the original poster:
chris@lenovo ~> apt list sudo*
Auflistung… Fertig
sudo/stable-security,now 1.9.5p2-3+deb11u1 amd64  [Installiert,automatisch]
N: Es gibt 1 zusätzliche Version. Bitte verwenden Sie die Option »-a«, um sie anzuzeigen.

4. Run apt list sudo
The result is the same as 3.

5. Delete the original empty file and create a modified one:
mv sudo sudolala

6. The first command of the original poster:
chris@lenovo ~> apt list sudo*
Auflistung… Fertig

There is no sudolala.

> Don't do that. It will drive you crazy.

Sure. Thanks for triggering me to do the small tests.
I did not want to hijack the thread. But I think it makes sense to
show the effect of missing quoting.

Kind regards,
Christoph
-- 
Ist die Katze gesund
schmeckt sie dem Hund.


Reply to: