Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1003044: python3-dateutil: python_dateutil get_zonefile_instance functionality is broken (no zoneinfo found)

270 views
Skip to first unread message

Sandro Tosi

unread,
Jan 7, 2023, 4:10:04 AM1/7/23
to
control: severity -1 grave

On Mon, 3 Jan 2022 08:41:20 +0000 "Pfuetz, Michael"
<Michael...@SARTORIUS.com> wrote:
> Subject: python3-dateutil: python_dateutil get_zonefile_instance functionality is broken (no zoneinfo found)
> Package: python3-dateutil
> X-Debbugs-Cc: Michael...@sartorius.com
> Version: 2.8.1-6
> Severity: normal
>
> Dear Maintainer,
>
> python-dateutil expects to have 'dateutil-zoneinfo.tar.gz' in it's directory
> tree, but this file is removed in the packaging.
>
> Error:
> "/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26: UserWarning:
> I/O error(2): Datei oder Verzeichnis nicht gefunden
> warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))"
>
> Using: "matplotlib.dates import DateFormatter"

indeed this is breaking matplotlib, thus the grave severity. it needs
to be addressed for bookworm

```
In [1]: from dateutil import zoneinfo

In [2]: zoneinfo.get_zonefile_instance()
/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26:
UserWarning: I/O error(2): No such file or directory
warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
Out[2]: <dateutil.zoneinfo.ZoneInfoFile at 0x7f5810824bd0>

In [3]: import dateutil

In [4]: dateutil.__version__
Out[4]: '2.8.2'
```

Felix Geyer

unread,
Jan 29, 2023, 9:50:04 AM1/29/23
to
On Sat, 7 Jan 2023 03:34:19 -0500 Sandro Tosi <mo...@debian.org> wrote:
> > python-dateutil expects to have 'dateutil-zoneinfo.tar.gz' in it's directory
> > tree, but this file is removed in the packaging.
> >
> > Error:
> > "/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26: UserWarning:
> > I/O error(2): Datei oder Verzeichnis nicht gefunden
> > warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))"
> >
> > Using: "matplotlib.dates import DateFormatter"
>
> indeed this is breaking matplotlib, thus the grave severity. it needs
> to be addressed for bookworm

How exactly does this break matplotlib?
dateutil.zoneinfo really shouldn't be used directly and I don't see any
reference to it in the matplotlib code.

dateutil.tz prefers the system timezone database so you should see this
warning only when trying to use a non-existent timezone.
Even then it is just a warning, not an exception that is thrown.

>>> import dateutil.tz
>>> dateutil.tz.gettz('UTC')
tzfile('/usr/share/zoneinfo/UTC')
>>> dateutil.tz.gettz('foo')
/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26: UserWarning: I/O error(2): No
such file or directory
warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))


I guess we have two options if we want to change the current behavior:
1) Ship the outdated tzdata tarball even though nothing should really use it.
2) Add a patch to remove the dateutil.zoneinfo fallback.

Sandro Tosi

unread,
Feb 21, 2023, 3:00:04 PM2/21/23
to
On Sun, Jan 29, 2023 at 9:45 AM Felix Geyer <fge...@debian.org> wrote:
>
> On Sat, 7 Jan 2023 03:34:19 -0500 Sandro Tosi <mo...@debian.org> wrote:
> > > python-dateutil expects to have 'dateutil-zoneinfo.tar.gz' in it's directory
> > > tree, but this file is removed in the packaging.
> > >
> > > Error:
> > > "/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26: UserWarning:
> > > I/O error(2): Datei oder Verzeichnis nicht gefunden
> > > warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))"
> > >
> > > Using: "matplotlib.dates import DateFormatter"
> >
> > indeed this is breaking matplotlib, thus the grave severity. it needs
> > to be addressed for bookworm
>
> How exactly does this break matplotlib?

it produces output on stderr, which many tools consider it an error
and fails build.

> dateutil.zoneinfo really shouldn't be used directly and I don't see any

can you back this quote please? zoneinfo is part of the public API,
and just breaking it (via the removal of the zonefile) and say not to
use it is going in the wrong direction.

> I guess we have two options if we want to change the current behavior:
> 1) Ship the outdated tzdata tarball even though nothing should really use it.
> 2) Add a patch to remove the dateutil.zoneinfo fallback.

i think you're missing

3) fix dateutil.zoneinfo to use a system-available zone info file

--
Sandro "morph" Tosi
My website: http://sandrotosi.me/
Me at Debian: http://wiki.debian.org/SandroTosi
Twitter: https://twitter.com/sandrotosi

James Addison

unread,
Feb 22, 2023, 7:00:05 AM2/22/23
to
Package: python3-dateutil
Followup-For: Bug #1003044
X-Debbugs-Cc: Michael...@SARTORIUS.com
Control: retitle -1 internal 'getzoneinfofile_stream' method emits a warning message
Control: forwarded -1 https://github.com/dateutil/dateutil/issues/903
Control: tags -1 moreinfo

On Tue, 21 Feb 2023 22:27:53 +0100, Felix wrote:
> I'm inclined to just ship the bundled timezone database with the package:

That may not be an option for us (at least without more work to find and
package the sources of the relevant zoneinfo database): tz data content was
removed from src:python-dateutil (the source of this package) to resolve
previous bug #665894, relating to dfsg-compatibility.

If the licensing status of the database in the upstream source has become
dfsg-compatible, then my mistake and perhaps we can go ahead and bundle it.
But that is not clear to me at the moment.

On Sun, 29 Jan 2023 15:41:10 +0100, Felix wrote:
>> How exactly does this break matplotlib?

On Tue, 21 Feb 2023 14:46:01 -0500, morph wrote:
> it produces output on stderr, which many tools consider it an error
> and fails build.

Michael or morph: can you provide a link or supporting details to justify the
severity of this bug (currently: grave[1])?

[1] - https://www.debian.org/Bugs/Developer#severities

Arnout Vandecappelle

unread,
Mar 3, 2023, 2:50:05 PM3/3/23
to
 [I picked up this bug as part of a Debian bugsquashing sprint together with my colleagues.]

 Since there's been some back-and-forth in this thread, let me first summarize the status.

- The following will print an ugly warning:

In [1]: from dateutil import zoneinfo

In [2]: zoneinfo.get_zonefile_instance()
/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26:
UserWarning: I/O error(2): No such file or directory
warnings.warn("I/O error({0}): {1}".format(e.errno, e.strerror))
Out[2]: <dateutil.zoneinfo.ZoneInfoFile at 0x7f5810824bd0>


- It's just a warning, but it may confuse tools that consume stderr, or build
scripts may fail if anything is emitted on stderr.

- The warning can also be triggered by requesting a timezone that doesn't exist:

In [1]: from dateutil import tz In [2]: tz.gettz('foo')
/usr/lib/python3/dist-packages/dateutil/zoneinfo/__init__.py:26: UserWarning:
I/O error(2): No such file or directory  warnings.warn("I/O error({0}):
{1}".format(e.errno, e.strerror)) - In this case, the warning is in fact
useless: if a timezone doesn't exist in the system database, it doesn't exist. -
Thus, the only case where the warning is relevant is when the bundled database
is used explicitly (by calling zoneinfo.get_zonefile_instance()).
However, this is not really a valid use case.


I conclude from this that all that really has to be done is to remove the
warning. Since the debian package doesn't have the bundled zoneinfo database,
it is not useful to issue a warning when there is no bundled zoneinfo database.
This bug is about the warning, not about the fact that the bundled zoninfo
database is missing.

Therefore, the attached patch removes the warning. This is done as part of
Remove_Zoneinfo_Tarball.patch because removing the database should really go
hand in hand with removing the warning. [Note that this is my first time
contribution to Debian packaging. I'm actually using Fedora myself :-). The
patch was tested by building it with pbuilder and running it in a bookworm
container. Please let me know if there is anything else I should do, or if there
is anything I should have done differently.] Regards, Arnout
python-dateutil_2.8.2-1.1.diff
0 new messages