[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[plamo:23878] Re: タイムスタンプ



From: 早間義博 <yossi@yedo.src.co.jp>
Subject: [plamo:23855] タイムスタンプ
Date: Mon, 11 Oct 2004 15:51:40 +0900 (JST)
Message-ID: <20041011.155140.41647420.yossi@yedo.src.co.jp>

> 早間です。
> plamo 4.0 kernel 2.6.7 上で作成・変更したファイルを
>    cp -p file /somewhere/file
> でコピーした時に
>    /somewhere/file : file
> と言う make の条件が変更できない事があります。
> 
> *詳述
>   cp -p file /somewhere/file
> を実行した時に受け側のファイルの日付は送り側と同一になると思うので
> すが
> 下記の Makefile で make を実行した直後に(i.e. file に対し変更など
> の操作を一切していない状態で) make を再実行すると再びコピーが実行
> される事があります(必ずではありません)。この現象が発生した file は
> その後何度 make を実行してもコピーが実行されます。( -p を外せば良
> いのでしょうが、同一内容のファイルでスタンプが変わる事は困ります)
> 
> まるで、UNIX から MSDOS ファイルにコピーして奇数秒が脱落したような
> 動きです。 と言うのは
>   cp -p /somewhere/file file
> を実行すればこの現象は停止します。
> 

#! /usr/bin/perl
$fx=$ARGV[0];
(my $dev,my $ino,my $mode,my $nlink,my $uid,my $gid,my $rdev,
 my $size,my $atime,my $mtime,my $ctime,my $blksize,my $blocks)=
 stat "/somewhere$fx";
print "$atime,$mtime,$ctime\n";
(my $dev,my $ino,my $mode,my $nlink,my $uid,my $gid,my $rdev,
 my $size,my $atime,my $mtime,my $ctime,my $blksize,my $blocks)=
 stat "$fx"; 
print "$atime,$mtime,$ctime\n";

と言うスクリプトで調べて見ました
   $atime       /* time of last access */
   $mtime;    /* time of last modification */
   $ctime;    /* time of last status change */
のつもりです。

1097746663,1097746644,1097746789  /somewhere/file
1097746789,1097746644,1097746644  file

の筈ですがこの状態で 
  cp -p file /somewhere/file
が何回でも起こります。
$ make
cp -p file /somewhere/file
$ ckdate file  <<--- 上記スクリプト
1097746663,1097746644,1097746789
1097746789,1097746644,1097746644
$ make
cp -p file /somewhere/file
$ ckdate file  <<--- 上記スクリプト
1097746789,1097746644,1097747233
1097747233,1097746644,1097746644
$ make
cp -p file /somewhere/file
$ ckdate file  <<--- 上記スクリプト
1097747233,1097746644,1097747340
1097747340,1097746644,1097746644

まるで $atime /* time of last access */ で make が働いているようで
す。
そこで、atime を変えて見ました。

$ cat /somewhere/file >/dev/null
$ ckdare file
1097748383,1097746644,1097748336
1097748336,1097746644,1097746644
$ make
cp -p file /somewhere/file

それでもコピーされます。

$ ls --full-time file /somewhere/file   では常に
-rwxr-xr-x 1 yossi users 1693 2004年10月14日 18時37分24秒 /somewhere/file
-rwxr-xr-x 1 yossi users 1693 2004年10月14日 18時37分24秒 file
と表示されています。

同じ Makefile にある別のファイルは次のように表示されてコピーされま
せん。
$ ckdate oth
1097746201,1054793665,1094080678
1097749564,1054793665,1093420980
$ ls --full-time oth /somewhere/oth
-rwxr-xr-x 1 yossi users  160 2003年06月05日 15時14分25秒 /somewhere/oth
-rwxr-xr-x 1 yossi users  160 2003年06月05日 15時14分25秒 oth

Plamo-src にgmake のソースが無かったので、(これを言い訳にして)
けふはここまでにします。

# ひょっとしてキャッシュのせいでしょうか

-- 早間  yossi@yedo.src.co.jp

References
[plamo:23855] タイムスタンプ, 早間義博

[検索ページ] [メール一覧]
Plamo ML 公開システム