Project

General

Profile

Bug #5907

python strftime doesn't work properly on Alpine Linux.

Added by Kaspars Sprogis almost 3 years ago. Updated 3 months ago.

Status:
Closed
Priority:
High
Assignee:
Category:
Base libraries
Target version:
Start date:
07/15/2016
Due date:
% Done:

100%

Estimated time:
Affected versions:
Security IDs:

Description

On Alpine Linux builds strftime returns empty string whenever dash is used.

Ubuntu/Mac/Debian & Python 2.7.10:

$ python
Python 2.7.10 (default, Oct 23 2015, 19:19:21)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.0.59.5)] on darwin

>>> import datetime
>>> datetime.datetime.now().strftime('%I')
'04'
>>> datetime.datetime.now().strftime('%-I')
'4'

alpine:3.4
PYTHON_VERSION=2.7.12-r0

$ python
Python 2.7.12 (default, Jun 29 2016, 08:57:23)
[GCC 5.3.0] on lType "help", "copyright", "credits" or "license" for more information.inux2

>>> import datetime
>>> datetime.datetime.now().strftime('%I')
'01'
>>> datetime.datetime.now().strftime('%-I')
''

Associated revisions

Revision f6baa2aa (diff)
Added by Timo Teräs almost 2 years ago

main/musl: cherry-pick upstream fixes, add strftime gnu extensions

ref #5907

Revision b4bedb97 (diff)
Added by Timo Teräs almost 2 years ago

main/musl: cherry-pick upstream fixes, add strftime gnu extensions

ref #5907

History

#1 Updated by Kaspars Sprogis almost 3 years ago

By googling I found these two links which may help resolving issue:
https://github.com/iron-io/dockers/issues/42
http://stackoverflow.com/a/28916983/641263

#2 Updated by Timo Teräs almost 3 years ago

This is known issue and discussed some months ago in musl mailing list:
http://www.openwall.com/lists/musl/2016/03/29/11

Basically it is GNU extension not implemented (yet), but might be implemented. However, it's non-posix conformant code so it's not likely portable to other unixes. But if you care about linux only...

#3 Updated by Timo Teräs over 2 years ago

Initial patch supporting this extension was posted for review on musl-dev:
http://www.openwall.com/lists/musl/2016/11/22/1

#4 Updated by Natanael Copa almost 2 years ago

  • Target version set to 3.7.0

#5 Updated by Natanael Copa over 1 year ago

  • Status changed from New to Feedback
  • Target version changed from 3.7.0 to 3.7.1

I think this is fixed. Can you please confirm that problem is fixed?

#6 Updated by Natanael Copa over 1 year ago

  • Status changed from Feedback to Resolved
  • % Done changed from 0 to 100

I verified that this is fixed. Thanks!

#7 Updated by Natanael Copa over 1 year ago

Fixed since alpine 3.6

#8 Updated by Shreyansh Khajanchi over 1 year ago

Hey, I think there is some mistake as it doesn't seems to be fixed or am I missing something?
This is the output from python3 on Alpine:3.7 on docker

Python 3.6.3 (default, Nov 21 2017, 14:55:19)
[GCC 6.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

from datetime import datetime
t = datetime.now()
print(t)

2017-12-05 09:17:54.672601

t.strftime('%-d')

''

t.strftime('%d')

'05'

#9 Updated by Natanael Copa 3 months ago

  • Status changed from Resolved to Closed

python2 was fixed since alpine:3.6. It seems that python3 is fixed from alpine:3.8 and newer.

Also available in: Atom PDF