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

Possible Solaris problem in 'checkout_entry()'

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Mar 17, 2008, 15:07 UTC
Message-ID
<alpine.LFD.1.00.0803170756390.3020@woody.linux-foundation.org>
I was looking at this due to the CE_UPDATE bug, and notice that we do
	if (!lstat(path, &st)) {
		... check if it's unchanged ..
		unlink(path);
		if (S_ISDIR(st.st_mode)) {
			..

and it hit me that didn't we have issues with Solaris allowing an "unlink()" to succeed on a directory when you are root, causing various problems later with lost inodes during fsck?

We fixed that in commit fa2e71c9e794c43634670b62d1b4bf58d1ae7e60 back last July, by avoiding to do the unlink() if it was already a directory in create_directories(). But it *looks* like the same problem exists if you use "git checkout -f" and have a directory where you expect a file.

I don't have any access to a Solaris box, nor do I want any, but this test-script (as root, remember) should show if this is a problem:

	mkdir repo
	cd repo
	git init
	echo "Testfile" > a
	git add a
	git commit -m "Initial commit"
	rm a
	mkdir a
	git checkout -f

where you probably need to then reboot and force a fsck to actually see if it caused problems.

Solaris is just totally incredible crap here, but maybe we should move the unlink to after that "if (S_ISDIR(..))" statement? And maybe somebody who has a Solaris support contract can try to kick some Sun *ss to get them to fix their crap?

			Linus
Next: Morten Welinder
Message 1 of 5 in “Possible Solaris problem in 'checkout_entry()'”
  1. Linus TorvaldsMar 17, 2008
  2. Morten WelinderMar 17, 2008
  3. Linus TorvaldsMar 17, 2008
  4. Linus TorvaldsMar 17, 2008
  5. Junio C HamanoMar 19, 2008

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.