-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 3 Dec 2003 11:34 am, Marshal Newrock wrote:
> On Tue, 3 Dec 2003, Zarick Lau wrote:
> > When I type date to check the time (just want to see whether I shall
> > sleep or not!) I find that, the system time is 12-03-2017. And a quick
> > look in the system reveal the fact that, near half of the system file
> > has the wrong date and the other half is correct!
> >
> > I think it may be my careless mistake made in some time before, anyway,
> > how can change the time of the file.
> >
> > first, is there a cmd/program to change the file's modified time?
>
> 'touch' will do this.  I would recommend using 'find' to find all files
> far in the future (say, at least +1 year) and -exec touch on them.  (But
> first -exec ls -l to make sure you're finding the right files.)
>

I agree. To check


info find to work out the time expression.

find / -mtime ??? -ls


to change:

find / -mtime ..... | xargs touch

> > second, I think just changing the file's time will break portage db, how
> > to resolve it. I have take a look in
> > /var/db/pkg/sys-apps/coreutils/CONTENTS
> > and see that there are a few columns, is that related to the timestamp
> > of installed files which is kept inside portage DB?

The times of the files are compared when you update or remove a package. If 
the modification time of the file is later that the CONTENTS file suggests 
than it will be left there when you update. This is bad and will need to be 
fixed.

find /var/db/pkg -name CONTENTS | xargs sed -i -e 's/
[INSERTTIME_MISSING_LAST_4_DIGITS][0-9]\{4\}$/[TIME_TO_NOW]/g'

e.g

find /var/db/pkg/ -name "CONTENTS" | xargs sed -i -e 's/106799[0-9]\{4\}
$/0970419185/g'

date '+%s' gives current time.

replace [INSERTTIME_MISSING_LAST_4_DIGITS] with the time in 2017- missing the 
last four digits. I assume some are diffent due to the time the emerge took. 
4 digits should allow for 2 and a bit hours. If you change to more change the 
"4" in the expression.

and [TIME_TO_NOW] and sometime about now.

date '+%s' gives current time.

info sed for a sed refence if you have doubts - it match numbers at the end of 
a line- there is unlikely to be a directory name that will match.

Remove -i (which performs the replacement of the file) initially just to make 
sure its doing the right thing.

have a good day.
- -- 

Daniel Black
- --
Proudly a Gentoo Linux User.
GnuPG/PGP signed and encrypted email preferred
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x32A64DC8
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)

iD8DBQE/zU6mTDSbtjKmTcgRAiyHAJ4vDqyim7Jax5UN2mZk1btrHanivgCgkxzH
FwBDAzk8bP4wpyl4mA7oQMI=
=wnNM
-----END PGP SIGNATURE-----


--
[EMAIL PROTECTED] mailing list

Reply via email to