git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-diff-files and fakeroot
@ 2006-01-17  2:10 Ryan Anderson
  2006-01-17  2:33 ` Junio C Hamano
  2006-01-17  2:36 ` Junio C Hamano
  0 siblings, 2 replies; 7+ messages in thread
From: Ryan Anderson @ 2006-01-17  2:10 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 731 bytes --]

I've been trying to track down a strange issue with building kernels
(and scripts/setlocalversion) and finally realized the problem was the
when run under fakeroot, git-diff-files thinks everything is changed
(deleted, I believe)

Oddly, running "git status" seems to correct things.

Running "fakeroot git-diff-files" gives me lines like this:


:100644 100644 f866059f24bacd314fa4a979334a9893dbfc19ba 0000000000000000000000000000000000000000 M      write-tree.c

Looking at strace output, I can't see a difference that appears meaningful,


I can probably work around this, some other way, but knowing if
this is something that is fixable in git itself or not would be nice.

Thanks!


-- 

Ryan Anderson
  sometimes Pug Majere


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

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

* Re: git-diff-files and fakeroot
  2006-01-17  2:10 git-diff-files and fakeroot Ryan Anderson
@ 2006-01-17  2:33 ` Junio C Hamano
  2006-01-17  2:36 ` Junio C Hamano
  1 sibling, 0 replies; 7+ messages in thread
From: Junio C Hamano @ 2006-01-17  2:33 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git

Ryan Anderson <ryan@michonline.com> writes:

> Oddly, running "git status" seems to correct things.
>
> Running "fakeroot git-diff-files" gives me lines like this:
>
> :100644 100644 f866059f24bacd314fa4a979334a9893dbfc19ba 0000000000000000000000000000000000000000 M      write-tree.c
>
> Looking at strace output, I can't see a difference that appears meaningful,

How does fakeroot keep track of fake ownerships?

That is, I suspect:

	$ date >foo
	$ ls -l foo
	-rw-rw-r--  1 junio junio 29 Jan 16 18:29 foo
	$ fakeroot sh -i
        # ls -l foo
	-rw-rw-r--  1 root root 29 Jan 16 18:29 foo

which means that under fakeroot, stat would give file ownerships
for *my* files as if they are owned by root.

And of course .git/index records the as me and fakeroot has no
way of knowing me maps to root in that fake environment.

"git status" includes "git update-index --refresh", which reads
from the stat bits and ownerships, notices that file contents have
not changed, and writes a new index file that records these stat
bits (so git thinks they are now owned by root).

If you come out of the fakeroot environment, I am reasonably
sure that you would find all the index entries are dirty again,
for exactly the same reason.  index thinks things are owned by
root, the files are owned by you, so without looking at file
contents, it says "these things might have changed".




	

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

* Re: git-diff-files and fakeroot
  2006-01-17  2:10 git-diff-files and fakeroot Ryan Anderson
  2006-01-17  2:33 ` Junio C Hamano
@ 2006-01-17  2:36 ` Junio C Hamano
  2006-01-17  5:27   ` Ryan Anderson
  1 sibling, 1 reply; 7+ messages in thread
From: Junio C Hamano @ 2006-01-17  2:36 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: git

Ryan Anderson <ryan@michonline.com> writes:

> I've been trying to track down a strange issue with building kernels
> (and scripts/setlocalversion) and finally realized the problem was the
> when run under fakeroot, git-diff-files thinks everything is changed
> (deleted, I believe)

BTW, Ryan, I suspect this is where you try to append "-dirty" to
the version number.  But I wonder why you are doing the build
under fakeroot to begin with?  Wasn't the SOP "build as
yourself, install as root"?

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

* Re: git-diff-files and fakeroot
  2006-01-17  2:36 ` Junio C Hamano
@ 2006-01-17  5:27   ` Ryan Anderson
  2006-01-17  5:59     ` Kyle Moffett
  0 siblings, 1 reply; 7+ messages in thread
From: Ryan Anderson @ 2006-01-17  5:27 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git, linux-kernel

On Mon, Jan 16, 2006 at 06:36:39PM -0800, Junio C Hamano wrote:
> Ryan Anderson <ryan@michonline.com> writes:
> 
> > I've been trying to track down a strange issue with building kernels
> > (and scripts/setlocalversion) and finally realized the problem was the
> > when run under fakeroot, git-diff-files thinks everything is changed
> > (deleted, I believe)
> 
> BTW, Ryan, I suspect this is where you try to append "-dirty" to
> the version number.  But I wonder why you are doing the build
> under fakeroot to begin with?  Wasn't the SOP "build as
> yourself, install as root"?

That's exactly what started this search, because I was running
"make deb-pkg". (Effectively.)  dpkg-buildpackage wants to think it is
running as root, either via sudo or via fakeroot.  I had my build
environment switched over entirely to fakeroot, as it just seems to be a
better practice, but I've temporarily switched back to sudo.

However, your explanation has pointed out to me how I can solve this -
run "fakeroot -u" instead of "fakeroot", and I think it will be fixed.

lkml cc:ed to hopefully stick this in an archive where someone else will
find it.





-- 

Ryan Anderson
  sometimes Pug Majere

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

* Re: git-diff-files and fakeroot
  2006-01-17  5:27   ` Ryan Anderson
@ 2006-01-17  5:59     ` Kyle Moffett
  2006-01-17  6:08       ` Ryan Anderson
  0 siblings, 1 reply; 7+ messages in thread
From: Kyle Moffett @ 2006-01-17  5:59 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: Junio C Hamano, git, linux-kernel

On Jan 17, 2006, at 00:27, Ryan Anderson wrote:
> On Mon, Jan 16, 2006 at 06:36:39PM -0800, Junio C Hamano wrote:
>> BTW, Ryan, I suspect this is where you try to append "-dirty" to  
>> the version number.  But I wonder why you are doing the build  
>> under fakeroot to begin with?  Wasn't the SOP "build as
>> yourself, install as root"?
>
> That's exactly what started this search, because I was running  
> "make deb-pkg". (Effectively.)  dpkg-buildpackage wants to think it  
> is running as root, either via sudo or via fakeroot.  I had my  
> build environment switched over entirely to fakeroot, as it just  
> seems to be a better practice, but I've temporarily switched back  
> to sudo.
>
> However, your explanation has pointed out to me how I can solve  
> this - run "fakeroot -u" instead of "fakeroot", and I think it will  
> be fixed.

You should run "make" first, then after that completes run "fakeroot  
make deb-pkg".  I think this is similar to what the Debian package  
"kernel-package" does, except it substitutes an alternate "debian/"  
directory.  IIRC, it just runs "make install" as a normal user to a  
staging directory, then runs "$(ROOTCMD) dpkg-deb -b [...]" to build  
the package.  IMHO it's somewhat of a cleaner solution, and I've used  
it for several years now with no issues.

Cheers,
Kyle Moffett

--
I have yet to see any problem, however complicated, which, when you  
looked at it in the right way, did not become still more complicated.
   -- Poul Anderson

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

* Re: git-diff-files and fakeroot
  2006-01-17  5:59     ` Kyle Moffett
@ 2006-01-17  6:08       ` Ryan Anderson
  2006-01-17 18:10         ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: Ryan Anderson @ 2006-01-17  6:08 UTC (permalink / raw)
  To: Kyle Moffett; +Cc: Junio C Hamano, git, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2069 bytes --]

Kyle Moffett wrote:

> On Jan 17, 2006, at 00:27, Ryan Anderson wrote:
>
>> On Mon, Jan 16, 2006 at 06:36:39PM -0800, Junio C Hamano wrote:
>>
>>> BTW, Ryan, I suspect this is where you try to append "-dirty" to 
>>> the version number.  But I wonder why you are doing the build  under
>>> fakeroot to begin with?  Wasn't the SOP "build as
>>> yourself, install as root"?
>>
>>
>> That's exactly what started this search, because I was running  "make
>> deb-pkg". (Effectively.)  dpkg-buildpackage wants to think it  is
>> running as root, either via sudo or via fakeroot.  I had my  build
>> environment switched over entirely to fakeroot, as it just  seems to
>> be a better practice, but I've temporarily switched back  to sudo.
>>
>> However, your explanation has pointed out to me how I can solve  this
>> - run "fakeroot -u" instead of "fakeroot", and I think it will  be
>> fixed.
>
>
> You should run "make" first, then after that completes run "fakeroot 
> make deb-pkg".  I think this is similar to what the Debian package 
> "kernel-package" does, except it substitutes an alternate "debian/" 
> directory.  IIRC, it just runs "make install" as a normal user to a 
> staging directory, then runs "$(ROOTCMD) dpkg-deb -b [...]" to build 
> the package.  IMHO it's somewhat of a cleaner solution, and I've used 
> it for several years now with no issues.


Right "make all && fakeroot make deb-pkg" was failing, because with
CONFIG_LOCALVERSION_AUTO set, I was both getting a "-dirty" string
appended to the version, as well as something awfully close to a full
rebuild due to the version number changing, and on top of all that, the
dpkg-buildpackage would fail, as "-dirty" doesn't have a number in it
(hence why you see dfsg1 or ubuntu0 in version strings.)

I think I might take your suggestion, and fix up the builddeb script to
do the "run as root" part itself, rather than needing to do it outside. 
It would make it possible to just run "make oldconfig deb-pkg" which
would make things a little bit simpler.

-- 

Ryan Anderson
  sometimes Pug Majere


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 256 bytes --]

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

* Re: git-diff-files and fakeroot
  2006-01-17  6:08       ` Ryan Anderson
@ 2006-01-17 18:10         ` Sam Ravnborg
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2006-01-17 18:10 UTC (permalink / raw)
  To: Ryan Anderson; +Cc: Kyle Moffett, Junio C Hamano, git, linux-kernel

On Tue, Jan 17, 2006 at 01:08:48AM -0500, Ryan Anderson wrote:
> 
> I think I might take your suggestion, and fix up the builddeb script to
> do the "run as root" part itself, rather than needing to do it outside. 
> It would make it possible to just run "make oldconfig deb-pkg" which
> would make things a little bit simpler.
If we do something it must be consistent for all *-pkg targets.
So fixing up builddeb is not enough, we must fix it for rpm etc also.

Not that I have looked into what is needed, but we shall not have
inconsistent behavious between the different *-pkg targets.

	Sam

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

end of thread, other threads:[~2006-01-17 18:10 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-17  2:10 git-diff-files and fakeroot Ryan Anderson
2006-01-17  2:33 ` Junio C Hamano
2006-01-17  2:36 ` Junio C Hamano
2006-01-17  5:27   ` Ryan Anderson
2006-01-17  5:59     ` Kyle Moffett
2006-01-17  6:08       ` Ryan Anderson
2006-01-17 18:10         ` Sam Ravnborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).