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

Re: New repo quickly corrupted

From
Linus Torvalds <torvalds@linux-foundation.org>
Date
Nov 15, 2007, 22:37 UTC
Message-ID
<alpine.LFD.0.9999.0711151434290.4260@woody.linux-foundation.org>
In-Reply-To
<alpine.LFD.0.9999.0711151708470.21255@xanadu.home>
On Thu, 15 Nov 2007, Nicolas Pitre wrote:
> 
> Does "dos2unix" override file access bits?  Because the object store is 
> always made read-only.

Almost all programs like that will entirely ignor the fact that something is read-only.

Why? Becuase you end up having to create a new file *anyway*. So nobody does modify-in-place, they literally end up doing

 - create temp-file
 - while (data) 
	read old file, write to tempfile
 - rename temp-file over oldfile

and unless you *explicitly* look at the permission bits you'll never even notice that the old file was read-only, because none of the steps above care at all!

So marking things read-only will give only limited protection. It will protect against most editors, and will protect against things that change files in-place and literally try to open the original file as read-write, but not much else.

			Linus
Previous: Nicolas PitreNext: Christian Couder
Message 7 of 11 in “New repo quickly corrupted”
  1. Jason SewallNov 15, 2007
  2. Junio C HamanoNov 15, 2007
  3. Jason SewallNov 15, 2007
  4. Linus TorvaldsNov 15, 2007
  5. Jason SewallNov 15, 2007
  6. Nicolas PitreNov 15, 2007
  7. Linus TorvaldsNov 15, 2007
  8. Christian CouderNov 16, 2007
  9. Andreas EricssonNov 16, 2007
  10. Christian CouderNov 17, 2007
  11. Robin RosenbergNov 17, 2007

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.