Bug#913274: Changing the _is_real_file() function

2019-01-07 Thread Stuart Prescott
Hi Colin, Many thanks for the additional information about how python-apt has changed and for looking over this change. It is much appreciated. > I might be inclined to suggest renaming _is_real_file, since its name is > a little misleading now. Maybe _has_fileno? Yes, that sounds like a very

Bug#913274: Changing the _is_real_file() function

2019-01-04 Thread Colin Watson
On Mon, Dec 31, 2018 at 07:45:52PM +1100, Stuart Prescott wrote: > Many years ago in doing the Python 2→3 port for python-debian, you wrote a > function to guard against giving file-like objects that were not file > handles to apt_pkg [1]. The reason I've been looking at this today is that > the

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-12-31 Thread Stuart Prescott
Control: tags -1 + patch Dear Marcus & python-debian co-maintainers, > > If other tools/libraries are more tolerant, including python-apt, > > would it make sense for python-debian to be more tolerant when using > > the in-built parser? In that case, the two parser implementations > > would be

Bug#913274: Emitting warnings from iter_paragraphs?

2018-12-31 Thread Stuart Prescott
Dear python-debian co-maintainers, iter_paragraphs has a use_apt_pkg parameter which tries to use python-apt's apt_pkg.TagFile if possible. If apt_pkg is not available or the data source given to iter_paragraphs is incompatible with apt_pkg.TagFile, use_apt_pkg is silently ignored. In the

Bug#913274: Changing the _is_real_file() function

2018-12-31 Thread Stuart Prescott
Hi Colin, Many years ago in doing the Python 2→3 port for python-debian, you wrote a function to guard against giving file-like objects that were not file handles to apt_pkg [1]. The reason I've been looking at this today is that the current check incorrectly identifies NamedTemporaryFile as not

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-12-31 Thread Stuart Prescott
Hi Marcus, > So in my case, the in-built parser is being used and it is stricter > than python-apt's parser? That is correct. > > BTW if you are read()ing so that you can deal with the compressed > > Pacakges.gz, TagFile can handle on-the-fly decompression. > > > > In [1]: from debian.deb822

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-13 Thread Marcus Furlong
> > Passing the contents does the correct thing in all other cases, so not > > sure why it would be having an issue with this? > > Ahah! > > TagFile only accepts filehandles, not static data: > > https://salsa.debian.org/apt-team/python-apt/blob/master/python/tag.cc#L750 > > In deb822.py there is

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-13 Thread Stuart Prescott
Hi Marcus, > I've narrowed down where the issue occurs. It happens when passing the > contents rather than the file handle to iter_paragraphs: > > ~# ipython3 > Python 3.5.3 (default, Jan 19 2017, 14:11:04) > Type "copyright", "credits" or "license" for more information. > > IPython 5.1.0 -- An

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-13 Thread Marcus Furlong
Control: retitle -1 Incorrectly parsing whitespace in Deb822.iter_paragraphs On Tue, 13 Nov 2018 at 23:42, Marcus Furlong wrote: > > > > I have come across a case where whitespace is added in > > > Packages{.gz,.bz2} and I am not sure how it should be parsed. > > [...] > > > Should this

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-13 Thread Marcus Furlong
> > I have come across a case where whitespace is added in > > Packages{.gz,.bz2} and I am not sure how it should be parsed. > [...] > > Should this whitespace be parsed as a paragraph delimiter? > > For a Packages file, each paragraph is defined as a set of DEBIAN/control > paragraphs; the

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-08 Thread Stuart Prescott
Hi Marcus, Thanks for this interesting report. > I have come across a case where whitespace is added in > Packages{.gz,.bz2} and I am not sure how it should be parsed. [...] > Should this whitespace be parsed as a paragraph delimiter? For a Packages file, each paragraph is defined as a set of

Bug#913274:

2018-11-08 Thread Marcus Furlong
Example to find the stanzas with extra whitespace: # curl -s http://packages.microsoft.com/repos/vscode/dists/stable/main/binary-amd64/Packages | grep -n -H "^ $" (standard input):3485: (standard input):3780: (standard input):3802: (standard input):3824: (standard input):3846: (standard

Bug#913274: Incorrectly parsing whitespace in Sources.iter_paragraphs

2018-11-08 Thread Marcus Furlong
Package: python-debian Version: 0.1.33 I have come across a case where whitespace is added in Packages{.gz,.bz2} and I am not sure how it should be parsed. Currently, the whitespace is being treated as a paragraph delimiter, in python-debian, but not by apt-get, etc. See, for example, line 3780