* [devel] archivemail: требуется помощь
@ 2008-03-12 17:59 Andrey Rahmatullin
  2008-03-12 18:39 ` Grigory Batalov
  0 siblings, 1 reply; 9+ messages in thread
From: Andrey Rahmatullin @ 2008-03-12 17:59 UTC (permalink / raw)
  To: ALT Devel discussion list
[-- Attachment #1: Type: text/plain, Size: 1498 bytes --]
В archivemail не проходят тесты на python 2.5 (на 2.4 нормально).
+ ./test_archivemail.py
.........................FFF...............................
======================================================================
FAIL: mbox timestamps should not change after semi-archival
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_archivemail.py", line 713, in testMixed
    self.assertEqual(self.mtime, new_mtime)
AssertionError: 1205344695.5484228 != 1205344695.5484221
======================================================================
FAIL: mbox timestamps should not change after no archival
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_archivemail.py", line 690, in testNew
    self.assertEqual(self.mtime, new_mtime)
AssertionError: 1205344695.5564232 != 1205344695.556422
======================================================================
FAIL: mbox timestamps should not change after archival
----------------------------------------------------------------------
Traceback (most recent call last):
  File "./test_archivemail.py", line 736, in testOld
    self.assertEqual(self.mtime, new_mtime)
AssertionError: 1205344695.5604217 != 1205344695.56042
-- 
WBR, wRAR (ALT Linux Team)
Powered by the ALT Linux fortune(8):
> Хм... "А как в Debian" (C)?
В Debian все хорошо.
		-- legion in devel@
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 17:59 [devel] archivemail: требуется помощь Andrey Rahmatullin
@ 2008-03-12 18:39 ` Grigory Batalov
  2008-03-12 18:59   ` Andrey Rahmatullin
  0 siblings, 1 reply; 9+ messages in thread
From: Grigory Batalov @ 2008-03-12 18:39 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]
On Wed, 12 Mar 2008 22:59:46 +0500, Andrey Rahmatullin wrote:
> В archivemail не проходят тесты на python 2.5 (на 2.4 нормально).
  Ошибка точности? (1205344695.5484228 != 1205344695.5484221)
> + ./test_archivemail.py
> .........................FFF...............................
> ======================================================================
> FAIL: mbox timestamps should not change after semi-archival
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "./test_archivemail.py", line 713, in testMixed
>     self.assertEqual(self.mtime, new_mtime)
> AssertionError: 1205344695.5484228 != 1205344695.5484221
> 
> ======================================================================
> FAIL: mbox timestamps should not change after no archival
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "./test_archivemail.py", line 690, in testNew
>     self.assertEqual(self.mtime, new_mtime)
> AssertionError: 1205344695.5564232 != 1205344695.556422
> 
> ======================================================================
> FAIL: mbox timestamps should not change after archival
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "./test_archivemail.py", line 736, in testOld
>     self.assertEqual(self.mtime, new_mtime)
> AssertionError: 1205344695.5604217 != 1205344695.56042
-- 
 Grigory Batalov,
 ALT Linux Team
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 18:39 ` Grigory Batalov
@ 2008-03-12 18:59   ` Andrey Rahmatullin
  2008-03-12 20:54     ` Grigory Batalov
  0 siblings, 1 reply; 9+ messages in thread
From: Andrey Rahmatullin @ 2008-03-12 18:59 UTC (permalink / raw)
  To: devel
[-- Attachment #1: Type: text/plain, Size: 401 bytes --]
On Wed, Mar 12, 2008 at 09:39:06PM +0300, Grigory Batalov wrote:
> > В archivemail не проходят тесты на python 2.5 (на 2.4 нормально).
>   Ошибка точности? (1205344695.5484228 != 1205344695.5484221)
Ну видимо.
Я просто не пойму, можно ли так mtime сравнивать.
-- 
WBR, wRAR (ALT Linux Team)
Powered by the ALT Linux fortune(8):
<drF_ckoff> вы мне мозги не парьте, они у меня и так слабые
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 18:59   ` Andrey Rahmatullin
@ 2008-03-12 20:54     ` Grigory Batalov
  2008-03-12 21:11       ` Andrey Rahmatullin
  0 siblings, 1 reply; 9+ messages in thread
From: Grigory Batalov @ 2008-03-12 20:54 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 826 bytes --]
On Wed, 12 Mar 2008 23:59:42 +0500, Andrey Rahmatullin wrote:
> > > В archivemail не проходят тесты на python 2.5 (на 2.4 нормально).
> >   Ошибка точности? (1205344695.5484228 != 1205344695.5484221)
> Ну видимо.
> Я просто не пойму, можно ли так mtime сравнивать.
  А, нет. Это os.utime отводит время назад.
$ touch test.txt
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
$ python test.py
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
  И так далее.
$ cat test.py
#!/usr/bin/python
import os
file = "test.txt"
mtime = os.path.getmtime(file)
atime = os.path.getatime(file)
os.utime(file, (atime, mtime))
-- 
 Grigory Batalov,
 ALT Linux Team
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 20:54     ` Grigory Batalov
@ 2008-03-12 21:11       ` Andrey Rahmatullin
  2008-03-12 21:36         ` Grigory Batalov
  2008-03-13 19:36         ` [devel] python looses milisecond (was: archivemail: требуется помощь) Grigory Batalov
  0 siblings, 2 replies; 9+ messages in thread
From: Andrey Rahmatullin @ 2008-03-12 21:11 UTC (permalink / raw)
  To: devel
On Wed, Mar 12, 2008 at 11:54:23PM +0300, Grigory Batalov wrote:
> $ ls -la --time-style=full-iso test.txt
> -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
> $ python test.py
> $ ls -la --time-style=full-iso test.txt
> -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
Ох.
Это баг в os.utime?
-- 
WBR, wRAR (ALT Linux Team)
Powered by the ALT Linux fortune(8):
<drF_ckoff> вы мне мозги не парьте, они у меня и так слабые
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 21:11       ` Andrey Rahmatullin
@ 2008-03-12 21:36         ` Grigory Batalov
  2008-03-12 21:38           ` Dmitry V. Levin
  2008-03-13 19:36         ` [devel] python looses milisecond (was: archivemail: требуется помощь) Grigory Batalov
  1 sibling, 1 reply; 9+ messages in thread
From: Grigory Batalov @ 2008-03-12 21:36 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 645 bytes --]
On Thu, 13 Mar 2008 02:11:29 +0500, Andrey Rahmatullin wrote:
> > $ ls -la --time-style=full-iso test.txt
> > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
> > $ python test.py
> > $ ls -la --time-style=full-iso test.txt
> > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
> Ох.
> Это баг в os.utime?
  Пока не знаю. Почему-то такая точность (доли секунды) у меня доступна
  только в хэшере, а в хост-системе - до целых секунд.
  Её же (точность) можно отключить командой os.stat_float_times(False),
  но это не спортивно =).
-- 
 Grigory Batalov,
 ALT Linux Team
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 21:36         ` Grigory Batalov
@ 2008-03-12 21:38           ` Dmitry V. Levin
  2008-03-12 21:47             ` Grigory Batalov
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry V. Levin @ 2008-03-12 21:38 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 755 bytes --]
On Thu, Mar 13, 2008 at 12:36:03AM +0300, Grigory Batalov wrote:
> On Thu, 13 Mar 2008 02:11:29 +0500, Andrey Rahmatullin wrote:
> 
> > > $ ls -la --time-style=full-iso test.txt
> > > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
> > > $ python test.py
> > > $ ls -la --time-style=full-iso test.txt
> > > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
> > Ох.
> > Это баг в os.utime?
> 
>   Пока не знаю. Почему-то такая точность (доли секунды) у меня доступна
>   только в хэшере, а в хост-системе - до целых секунд.
Эта точность зависит от файловой системы.
>   Её же (точность) можно отключить командой os.stat_float_times(False),
>   но это не спортивно =).
-- 
ldv
[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* Re: [devel] archivemail: требуется помощь
  2008-03-12 21:38           ` Dmitry V. Levin
@ 2008-03-12 21:47             ` Grigory Batalov
  0 siblings, 0 replies; 9+ messages in thread
From: Grigory Batalov @ 2008-03-12 21:47 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 774 bytes --]
On Thu, 13 Mar 2008 00:38:57 +0300, Dmitry V. Levin wrote:
> > > > $ ls -la --time-style=full-iso test.txt
> > > > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
> > > > $ python test.py
> > > > $ ls -la --time-style=full-iso test.txt
> > > > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
> > > Ох.
> > > Это баг в os.utime?
> > 
> >   Пока не знаю. Почему-то такая точность (доли секунды) у меня доступна
> >   только в хэшере, а в хост-системе - до целых секунд.
> 
> Эта точность зависит от файловой системы.
  Понятно: мой хэшер - в tmpfs.
> >   Её же (точность) можно отключить командой os.stat_float_times(False),
> >   но это не спортивно =).
-- 
 Grigory Batalov,
 ALT Linux Team
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
* [devel] python looses milisecond (was: archivemail: требуется помощь)
  2008-03-12 21:11       ` Andrey Rahmatullin
  2008-03-12 21:36         ` Grigory Batalov
@ 2008-03-13 19:36         ` Grigory Batalov
  1 sibling, 0 replies; 9+ messages in thread
From: Grigory Batalov @ 2008-03-13 19:36 UTC (permalink / raw)
  To: ALT Linux Team development discussions
[-- Attachment #1: Type: text/plain, Size: 2790 bytes --]
On Thu, 13 Mar 2008 02:11:29 +0500, Andrey Rahmatullin wrote:
> > $ ls -la --time-style=full-iso test.txt
> > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737319000 +0300 test.txt
> > $ python test.py
> > $ ls -la --time-style=full-iso test.txt
> > -rw-r--r-- 1 builder builder 0 2008-03-12 23:47:55.737318000 +0300 test.txt
> Ох.
> Это баг в os.utime?
  Налицо две проблемы:
1. stat(2) оперирует с точностью до наносекунд (struct stat: st_mtim.tv_nsec),
   а utimes(2) - до милисекунд (struct timeval: tv_usec). Так что сравнивать
   время модификации файла до и после utimes со стороны test_archivemail.py
   неосмотрительно =).
2. комбинация os.path.getmtime/os.utime таки не просто округляет время
   до меньшего, но умудряется иногда терять милисекунду:
$ touch test.txt
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793640217 +0300 test.txt
$ python ~/test.py
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793640000 +0300 test.txt
$ python ~/test.py
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793639000 +0300 test.txt
$ python ~/test.py
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793638000 +0300 test.txt
$ python ~/test.py
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793637000 +0300 test.txt
$ gcc -Wall -g -o ~/test ~/test.c
$ ~/test
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793637000 +0300 test.txt
$ ~/test
$ ls -la --time-style=full-iso test.txt
-rw-r--r-- 1 bga bga 0 2008-03-13 22:16:55.793637000 +0300 test.txt
--------------
$ cat ~/test.py 
#!/usr/bin/python
import os
file = "test.txt"
mtime = os.path.getmtime(file)
atime = os.path.getatime(file)
os.utime(file, (atime, mtime))
--------------
$ cat ~/test.c
#include <sys/types.h>
#include <utime.h>
#include <sys/time.h>
#include <stdio.h>
#include <errno.h>
#include <sys/stat.h>
#include <unistd.h>
int errno;
int main(int argc, char *argv[]) {
        struct timeval tvp[3];
        char filename[] = "test.txt";
        struct stat st;
        if (stat(filename, &st) == -1) {
                perror("stat");
                return -1;
        }
        tvp[0].tv_sec = st.st_atim.tv_sec;
        tvp[0].tv_usec = st.st_atim.tv_nsec/1000;
        tvp[1].tv_sec = st.st_mtim.tv_sec;
        tvp[1].tv_usec = st.st_mtim.tv_nsec/1000;
        tvp[2].tv_sec = st.st_ctim.tv_sec;
        tvp[2].tv_usec = st.st_ctim.tv_nsec/1000;
        
        if (utimes(filename, tvp) == -1)
                perror("utimes");
        return 0;
}
-- 
 Grigory Batalov,
 ALT Linux Team
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply	[flat|nested] 9+ messages in thread
end of thread, other threads:[~2008-03-13 19:36 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-12 17:59 [devel] archivemail: требуется помощь Andrey Rahmatullin
2008-03-12 18:39 ` Grigory Batalov
2008-03-12 18:59   ` Andrey Rahmatullin
2008-03-12 20:54     ` Grigory Batalov
2008-03-12 21:11       ` Andrey Rahmatullin
2008-03-12 21:36         ` Grigory Batalov
2008-03-12 21:38           ` Dmitry V. Levin
2008-03-12 21:47             ` Grigory Batalov
2008-03-13 19:36         ` [devel] python looses milisecond (was: archivemail: требуется помощь) Grigory Batalov
ALT Linux Team development discussions
This inbox may be cloned and mirrored by anyone:
	git clone --mirror http://lore.altlinux.org/devel/0 devel/git/0.git
	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 devel devel/ http://lore.altlinux.org/devel \
		devel@altlinux.org devel@altlinux.ru devel@lists.altlinux.org devel@lists.altlinux.ru devel@linux.iplabs.ru mandrake-russian@linuxteam.iplabs.ru sisyphus@linuxteam.iplabs.ru
	public-inbox-index devel
Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.devel
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git