git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Destructive side-effect of "cg-status"

From
WDWolfgang Denk <wd@denx.de>
Date
Sep 30, 2005, 16:03 UTC
Message-ID
<20050930160353.F025C352B7B@atlas.denx.de>

So far I thought "cg-status" is a harmless command which just displays some status information. It ain't so. One of our engineers reported a corrupted repository after I ran "cg-status" in his directory:

$ cg-status
Heads:
   >master      805f93e4ca96d0c0cb2d2f9532d9666b22961e88
  R origin      805f93e4ca96d0c0cb2d2f9532d9666b22961e88

error: open failed fatal: cache corrupted error: open failed ? COPYING ? CREDITS ? Documentation/00-INDEX ? Documentation/BUG-HUNTING ... error: open failed read_cache: Permission denied ... error: open failed read_cache: Permission denied ...

As mentioned before, all I did was running "cg-status" in his directory. Here is what happens:

Before:
	-> rpm -q cogito
	cogito-0.15.1-1
	-> id
	uid=500(wd) gid=500(wd) groups=200(gitmaster),400(denx),500(wd)
	-> umask
	0002
	-> ls -ld .git
	drwxrwxrwx  6 sr sr 80 Sep 30 17:49 .git
	-> ls -l .git/index
	-rw-r--r--  1 sr sr 1728032 Sep 30 17:17 .git/index
Then:
	-> cg-status
	Heads:
	   >master      805f93e4ca96d0c0cb2d2f9532d9666b22961e88
	  R origin      805f93e4ca96d0c0cb2d2f9532d9666b22961e88
	M arch/ppc/configs/bubinga_defconfig
	M arch/ppc/configs/walnut_defconfig
	-> ls -l .git/index
	-rw-------  1 wd wd 1728032 Sep 30 17:49 .git/index
	^^^^^^^^^^    ^^^^^

That means, that "cg-status" actually *rewrote* .git/index, with me (wd) as new owner, and - ignoring my umask - with permissions that prevent the original owner (sr) to access the file!

Arghhhh!!!
Best regards,
Wolfgang Denk
-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd@denx.de
Generally speaking, there are other ways to accomplish whatever it is
that you think you need ...                               - Doug Gwyn
Next: Martin Langhoff
Message 1 of 18 in “Destructive side-effect of "cg-status"”
  1. Wolfgang DenkSep 30, 2005
  2. Martin LanghoffOct 1, 2005
  3. Linus TorvaldsOct 1, 2005
  4. Junio C HamanoOct 1, 2005
  5. Honor extractor's umask in git-tar-tree.Junio C Hamano, Oct 1, 2005
  6. H. Peter AnvinOct 2, 2005
  7. Matthias UrlichsOct 2, 2005
  8. H. Peter AnvinOct 3, 2005
  9. Junio C HamanoOct 3, 2005
  10. H. Peter AnvinOct 3, 2005
  11. Junio C HamanoOct 3, 2005
  12. H. Peter AnvinOct 3, 2005
  13. Linus TorvaldsOct 3, 2005
  14. H. Peter AnvinOct 3, 2005
  15. Linus TorvaldsOct 3, 2005
  16. H. Peter AnvinOct 3, 2005
  17. Wolfgang DenkOct 1, 2005
  18. Linus TorvaldsOct 1, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.