All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Bug 7646] New: strftime on datetime not works on python3.
@ 2014-11-12 12:55 bugzilla at busybox.net
  2014-11-12 13:11 ` [Buildroot] [Bug 7646] " bugzilla at busybox.net
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 12:55 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

           Summary: strftime on datetime not works on python3.
           Product: buildroot
           Version: unspecified
          Platform: Other
        OS/Version: Linux
            Status: NEW
          Severity: critical
          Priority: P5
         Component: Outdated package
        AssignedTo: unassigned at buildroot.uclibc.org
        ReportedBy: beyonlo at gmail.com
                CC: buildroot at uclibc.org
   Estimated Hours: 0.0


I set python3 to compile in buildroot and the strftime not works:


# uname -a
Linux buildroot 3.13.5 #1 Wed Nov 12 09:42:52 BRST 2014 armv5tejl GNU/Linux
# python3
Python 3.4.1 (default, Nov 12 2014, 09:22:50) 
[GCC 4.4.5] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from datetime import datetime
>>> datetime.now().strftime("%Y-%m-%d %H:%M:%S")
''
>>> 

As I know, strftime use locale. So I change toolchain to:
"[*] Toolchain has locale support?"

And compile buildroot again. But still not works. The same problem.

However, I tried to do a simple test in C using locale. The strftime works fine
in C.

# uname -a
Linux buildroot 3.13.5 #1 Wed Nov 12 09:42:52 BRST 2014 armv5tejl GNU/Linux
# file test2
test2: ELF 32-bit LSB executable, ARM, EABI5 version 1 (SYSV), dynamically
linked (uses shared libs), not stripped
# ./test2 
Locale is: (null)
Locale is: (null)
Date is: Fri Sep 12 16:34:33 2014
# 

This is the c example compiled (using arm cross compile) in the host and put in
the embedded buildroot:
$ cat test2.c 
#include <locale.h>
#include <stdio.h>
#include <time.h>

int main ()
{
   time_t currtime;
   struct tm *timer;
   char buffer[80];

   time( &currtime );
   timer = localtime( &currtime );

   printf("Locale is: %s\n", setlocale(LC_ALL, "en_US"));
   printf("Locale is: %s\n", setlocale(LC_CTYPE, "en_US.UTF-8"));
   strftime(buffer,80,"%c", timer );
   printf("Date is: %s\n", buffer);

   return(0);
}

Thank you.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
@ 2014-11-12 13:11 ` bugzilla at busybox.net
  2014-11-12 13:12 ` bugzilla at busybox.net
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 13:11 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #1 from Beyonlo <beyonlo@gmail.com> 2014-11-12 13:11:25 UTC ---
Created attachment 5756
  --> https://bugs.busybox.net/attachment.cgi?id=5756
The .config of buildroot.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
  2014-11-12 13:11 ` [Buildroot] [Bug 7646] " bugzilla at busybox.net
@ 2014-11-12 13:12 ` bugzilla at busybox.net
  2014-11-12 13:18 ` bugzilla at busybox.net
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 13:12 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #2 from Beyonlo <beyonlo@gmail.com> 2014-11-12 13:12:14 UTC ---
Created attachment 5762
  --> https://bugs.busybox.net/attachment.cgi?id=5762
The .config of Linux

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
  2014-11-12 13:11 ` [Buildroot] [Bug 7646] " bugzilla at busybox.net
  2014-11-12 13:12 ` bugzilla at busybox.net
@ 2014-11-12 13:18 ` bugzilla at busybox.net
  2014-11-12 14:33 ` bugzilla at busybox.net
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 13:18 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #3 from Beyonlo <beyonlo@gmail.com> 2014-11-12 13:18:48 UTC ---
buildroot$ git show | grep -i commit
commit f21256b86adc88665f6fe1c16672ee7ebf76d6db

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (2 preceding siblings ...)
  2014-11-12 13:18 ` bugzilla at busybox.net
@ 2014-11-12 14:33 ` bugzilla at busybox.net
  2014-11-12 22:28 ` bugzilla at busybox.net
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 14:33 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #4 from Beyonlo <beyonlo@gmail.com> 2014-11-12 14:33:27 UTC ---
buildroot$ git describe
2014.08-rc2-42-gf21256b

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (3 preceding siblings ...)
  2014-11-12 14:33 ` bugzilla at busybox.net
@ 2014-11-12 22:28 ` bugzilla at busybox.net
  2014-11-12 22:33 ` bugzilla at busybox.net
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 22:28 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

Thomas Petazzoni <thomas.petazzoni@free-electrons.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|Outdated package            |Other

--- Comment #5 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-12 22:28:22 UTC ---
Problem reproduced.

One data point is that python3 has the problem, but not python2. Tested with
the same uClibc toolchain.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (4 preceding siblings ...)
  2014-11-12 22:28 ` bugzilla at busybox.net
@ 2014-11-12 22:33 ` bugzilla at busybox.net
  2014-11-12 22:45 ` bugzilla at busybox.net
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 22:33 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #6 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-12 22:33:00 UTC ---
Another data point is that it breaks with uClibc (at least the toolchain at
http://autobuild.buildroot.org/toolchains/tarballs/br-arm-full-2014.08.tar.bz2),
but works with glibc (CodeSourcery ARM 2014.05).

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (5 preceding siblings ...)
  2014-11-12 22:33 ` bugzilla at busybox.net
@ 2014-11-12 22:45 ` bugzilla at busybox.net
  2014-11-13 10:36 ` bugzilla at busybox.net
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-12 22:45 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #7 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-12 22:45:49 UTC ---
Hint: since Python 3, Python is using wcsftime() instead of strftime() while
Python 2 was using strftime().

Beyonlo, could you write a C program to test wcsftime() and verify that it
works?

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (6 preceding siblings ...)
  2014-11-12 22:45 ` bugzilla at busybox.net
@ 2014-11-13 10:36 ` bugzilla at busybox.net
  2014-11-13 10:45 ` bugzilla at busybox.net
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-13 10:36 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #8 from Beyonlo <beyonlo@gmail.com> 2014-11-13 10:36:17 UTC ---
Hello, I did the tests with wcsftime. I used this example
http://www.cplusplus.com/reference/cwchar/wcsftime/

$ cat wcsftime_test1.c 
/* wcsftime example */
#include <wchar.h>
#include <time.h>

int main ()
{
  time_t rawtime;
  struct tm * timeinfo;
  wchar_t buffer [80];

  time ( &rawtime );
  timeinfo = localtime ( &rawtime );

  wcsftime (buffer,80,L"Now it's %I:%M%p.",timeinfo);
  wprintf (L"%ls\n",buffer);

  return 0;
}


Compiled and run on host:
$ ./wcsftime_test1 
Now it's 08:30AM.

Compiled on host (using cross compile - same process used in test2.c) to run on
target (buildroot):
# uname -a
Linux buildroot 3.13.5 #1 Wed Nov 12 09:42:52 BRST 2014 armv5tejl GNU/Linux
# ./wcsftime_test1 
# 

Ps: Show nothing on buildroot.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (7 preceding siblings ...)
  2014-11-13 10:36 ` bugzilla at busybox.net
@ 2014-11-13 10:45 ` bugzilla at busybox.net
  2014-11-13 12:18 ` bugzilla at busybox.net
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-13 10:45 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #9 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-13 10:45:43 UTC ---
So wcsftime() is broken in uClibc. It's not a Buildroot bug, but a uClibc bug.
We can workaround it for Python 3 by telling Python explicitly to not use
wcsftime().

We would need to test if uClibc master is affected or not. If it isn't, then we
should backport the patch. It it is, then we should report the bug to upstream
uClibc.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (8 preceding siblings ...)
  2014-11-13 10:45 ` bugzilla at busybox.net
@ 2014-11-13 12:18 ` bugzilla at busybox.net
  2014-11-13 20:31 ` bugzilla at busybox.net
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-13 12:18 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #10 from Beyonlo <beyonlo@gmail.com> 2014-11-13 12:18:13 UTC ---
Hello.

Well, if the quickly solution is by telling Python explicitly to not use
wcsftime(), I think is a good idea. But I don't know if this solution is the
best way.

If you need more tests, please, let me know.

Thank you.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (9 preceding siblings ...)
  2014-11-13 12:18 ` bugzilla at busybox.net
@ 2014-11-13 20:31 ` bugzilla at busybox.net
  2014-11-13 22:37 ` bugzilla at busybox.net
  2014-11-14  8:28 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-13 20:31 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #11 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-13 20:31:45 UTC ---
Here is a quick patch that tells Python3 to not use wcsftime() on uClibc, and
it fixes the problem for me:

diff --git a/package/python3/python3.mk b/package/python3/python3.mk
index 2c1ef2a..e242835 100644
--- a/package/python3/python3.mk
+++ b/package/python3/python3.mk
@@ -107,6 +107,10 @@ PYTHON3_CONF_ENV += \
        ac_cv_file__dev_ptc=yes \
        ac_cv_working_tzset=yes

+ifeq ($(BR2_TOOLCHAIN_USES_UCLIBC),y)
+PYTHON3_CONF_ENV += ac_cv_func_wcsftime=no
+endif
+
 PYTHON3_CONF_OPTS += \
        --without-ensurepip     \
        --without-cxx-main      \

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (10 preceding siblings ...)
  2014-11-13 20:31 ` bugzilla at busybox.net
@ 2014-11-13 22:37 ` bugzilla at busybox.net
  2014-11-14  8:28 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-13 22:37 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

--- Comment #12 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-13 22:37:39 UTC ---
Patch to workaround the problem in Python 3 sent to Buildroot:
http://lists.busybox.net/pipermail/buildroot/2014-November/112005.html

uClibc bug reproduced with uClibc master, and bug reported to upstream uClibc:
http://lists.uclibc.org/pipermail/uclibc/2014-November/048718.html.

Since I don't expect the uClibc folks to react quickly, I would propose to mark
this bug as fixed once the Python 3 workaround is committed in Buildroot.

Beyonlo, can you test the Buildroot patch for Python 3, and report if it works
for you (it works for me, so I'm pretty sure it's ok, but still). Thanks!

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [Buildroot] [Bug 7646] strftime on datetime not works on python3.
  2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
                   ` (11 preceding siblings ...)
  2014-11-13 22:37 ` bugzilla at busybox.net
@ 2014-11-14  8:28 ` bugzilla at busybox.net
  12 siblings, 0 replies; 14+ messages in thread
From: bugzilla at busybox.net @ 2014-11-14  8:28 UTC (permalink / raw)
  To: buildroot

https://bugs.busybox.net/show_bug.cgi?id=7646

Thomas Petazzoni <thomas.petazzoni@free-electrons.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #13 from Thomas Petazzoni <thomas.petazzoni@free-electrons.com> 2014-11-14 08:28:56 UTC ---
Patch work-arounding the problem for Python 3 has been applied, see
http://git.buildroot.net/buildroot/commit/?id=5ad4ac083276b3504889c39351a56d947f172b5f.

The same problem can occur with other packages, but unfortunately, there's not
much we can do at this point, except waiting for the uClibc folks to react.

Since the original problem related to Python 3 is now fixed, I'm closing this
bug.

-- 
Configure bugmail: https://bugs.busybox.net/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2014-11-14  8:28 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-11-12 12:55 [Buildroot] [Bug 7646] New: strftime on datetime not works on python3 bugzilla at busybox.net
2014-11-12 13:11 ` [Buildroot] [Bug 7646] " bugzilla at busybox.net
2014-11-12 13:12 ` bugzilla at busybox.net
2014-11-12 13:18 ` bugzilla at busybox.net
2014-11-12 14:33 ` bugzilla at busybox.net
2014-11-12 22:28 ` bugzilla at busybox.net
2014-11-12 22:33 ` bugzilla at busybox.net
2014-11-12 22:45 ` bugzilla at busybox.net
2014-11-13 10:36 ` bugzilla at busybox.net
2014-11-13 10:45 ` bugzilla at busybox.net
2014-11-13 12:18 ` bugzilla at busybox.net
2014-11-13 20:31 ` bugzilla at busybox.net
2014-11-13 22:37 ` bugzilla at busybox.net
2014-11-14  8:28 ` bugzilla at busybox.net

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.