[p4] fstat digest of text file (CALL#2327524)

Sergey Klibanov sklibanov at day1studios.com
Fri Mar 27 04:57:25 PDT 2009


That answers everything.

 

Benjamin, you asked why... Well, I have an automated process where I
need to compare locally-generated files against their head revision in
the depot. The wrinkle is that for a variety of reasons the files I need
to compare aren't synced on the machine running this operation, and may
even reside some place other than where the client spec thinks they
should be. I looked at p4 help diff for a bit, but found no way to get
it to report diffs for un-synced and badly-located files.

 

So I'm just comparing the digest of the locally-generated file to the
one reported by fstat. Converting the line endings locally before
calculating a hash seems totally reasonable, I was just making sure the
behavior would be consistent.

 

If there's a cleaner way to get that done (without syncing the files and
comparing in-place, that is), I'd be glad to try. 

 

Thanks for your quick responses, everyone! :)

 

-S

 

 

 

-----Original Message-----
From: Benjamin Ma [mailto:support at perforce.com] 
Sent: Thursday, March 26, 2009 8:48 PM
To: Jeff A. Bowles; Sergey Klibanov
Subject: Re: [p4] fstat digest of text file (CALL#2327524)

 

Hello Jeff,

 

> I do not have more details, but it looks fairly self-explanatory...

 

Yes, indeed.

 

> It looks like fstat -Ol run on a text file reports a digest made with

> unix-style endlines (\n) and not Windows-style endlines (\r\n). 

> Will this always be the case? 

 

Yes, Perforce Server processes all text files using Unix-style LF
line-endings.

Although Perforce stores server archive files on disk in the operating
system's

native line termination convention (CR/LF on Windows, LF on Unix), all

line-endings are normalized to Unix-style LF line-endings for internal
Perforce

Server operations including 'p4 fstat'.

 

> Does this behavior change with the platform the server runs on? 

 

No, as explained above.

 

> Is it a server configuration option?

 

Maybe I am why do you need this, so that I can log an enhancement
request for

you if you want.

 

You may find it useful to refer to the following article:

 

  CR/LF Issues and Text Line-endings

  http://kb.perforce.com/?article=63

 

If you have any further questions, please let me know.

 

Regards,

 

Ben

 

--

Benjamin Ma

Technical Support

Perforce Software Australia

 

Come to the 2009 Perforce User Conference, April 29, 30 & May 1 in Las
Vegas.

Learn more: http://www.perforce.com/conf




More information about the perforce-user mailing list