git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* 'git clone,' build makes user non-writable files (should be option keep user-writable)
@ 2022-07-15 10:35 David Chmelik
  2022-07-17 11:21 ` Beat Bolli
       [not found] ` <YtPtQ6qsIviyTBF2@zbox.drbeat.li>
  0 siblings, 2 replies; 8+ messages in thread
From: David Chmelik @ 2022-07-15 10:35 UTC (permalink / raw)
  To: git

What did you do before the bug happened?
'git clone,' built various software (with gcc, BSD & GNU make, 
autotools, cmake, etc.)

What did you expect to happen?
Option: keep cloned/built/etc. files user-writable.

What happened instead?
Needed chmod or 'sudo rm -rf.'

What's different between what you expected and what actually happened?
Option: keep cloned/built/etc. files user-writable, otherwise (has been 
said 15+ years) encourages 'sudo rm -rf.'

Anything else you want to add:
         I try/test/debug (and report bugs) many software commits but 
don't commit so need cloned/built/etc. files writable as user & even 
system-wide options: who hasn't made 'rm -rf' mistakes? (unrelated but 
someone might claim is: I don't use non-UNIX-like OS that shell alias 
'rm -rf' to confirm every file (potentially thousands) and though made 
my own alias (confirm once) it's longer, sometimes unavailable so don't 
always use (many people don't)... software should always have 
user-writable files option.)  Below indicates GNU/Linux but also have 
often used git on *BSD/Unix.  I'm not on git mailing list but you can CC 
me all replies.

[System Info]
git version:
git version 2.37.1
cpu: x86_64
no commit associated with this build
sizeof-long: 8
sizeof-size_t: 8
shell-path: /bin/sh
uname: Linux 5.18.11 #1 SMP PREEMPT_DYNAMIC Wed Jul 13 00:20:29 CDT 2022 
x86_64
compiler info: gnuc: 12.1
libc info: glibc: 2.35
$SHELL (typically, interactive shell): /bin/bash


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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
  2022-07-15 10:35 'git clone,' build makes user non-writable files (should be option keep user-writable) David Chmelik
@ 2022-07-17 11:21 ` Beat Bolli
       [not found] ` <YtPtQ6qsIviyTBF2@zbox.drbeat.li>
  1 sibling, 0 replies; 8+ messages in thread
From: Beat Bolli @ 2022-07-17 11:21 UTC (permalink / raw)
  To: David Chmelik; +Cc: git

On Fri, Jul 15, 2022 at 03:35:49AM -0700, David Chmelik wrote:

[resend with reply-to-all]

> What did you do before the bug happened?
> 'git clone,' built various software (with gcc, BSD & GNU make, autotools,
> cmake, etc.)
> 
> What did you expect to happen?
> Option: keep cloned/built/etc. files user-writable.
> 
> What happened instead?
> Needed chmod or 'sudo rm -rf.'
> 
> What's different between what you expected and what actually happened?
> Option: keep cloned/built/etc. files user-writable, otherwise (has been said
> 15+ years) encourages 'sudo rm -rf.'
> 
> Anything else you want to add:
>         I try/test/debug (and report bugs) many software commits but don't
> commit so need cloned/built/etc. files writable as user & even system-wide
> options: who hasn't made 'rm -rf' mistakes? (unrelated but someone might
> claim is: I don't use non-UNIX-like OS that shell alias 'rm -rf' to confirm
> every file (potentially thousands) and though made my own alias (confirm
> once) it's longer, sometimes unavailable so don't always use (many people
> don't)... software should always have user-writable files option.)  Below
> indicates GNU/Linux but also have often used git on *BSD/Unix.  I'm not on
> git mailing list but you can CC me all replies.

When building software as the current user, the build artefacts are
owned by this user.

Are you building the software using Docker containers that run as root?

Regards, Beat

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
       [not found] ` <YtPtQ6qsIviyTBF2@zbox.drbeat.li>
@ 2022-07-22 13:23   ` David Chmelik
       [not found]     ` <CAPx1Gvc6ci1CjhL-zjwqkR=4o2yQTrT0V_Hb9bUBNuaBn47M8A@mail.gmail.com>
  2022-07-23  4:11     ` Đoàn Trần Công Danh
  0 siblings, 2 replies; 8+ messages in thread
From: David Chmelik @ 2022-07-22 13:23 UTC (permalink / raw)
  To: git-l

On 7/17/22 4:06 AM, Beat Bolli wrote:
> On Fri, Jul 15, 2022 at 03:35:49AM -0700, David Chmelik wrote:
>> What did you do before the bug happened?
>> 'git clone,' built various software (with gcc, BSD & GNU make, autotools,
>> cmake, etc.)
>>
>> What did you expect to happen?
>> Option: keep cloned/built/etc. files user-writable.
>>
>> What happened instead?
>> Needed chmod or 'sudo rm -rf.'
>>
>> What's different between what you expected and what actually happened?
>> Option: keep cloned/built/etc. files user-writable, otherwise (has been said
>> 15+ years) encourages 'sudo rm -rf.'
>>
>> Anything else you want to add:
>>          I try/test/debug (and report bugs) many software commits but don't
>> commit so need cloned/built/etc. files writable as user & even system-wide
>> options: who hasn't made 'rm -rf' mistakes? (unrelated but someone might
>> claim is: I don't use non-UNIX-like OS that shell alias 'rm -rf' to confirm
>> every file (potentially thousands) and though made my own alias (confirm
>> once) it's longer, sometimes unavailable so don't always use (many people
>> don't)... software should always have user-writable files option.)  Below
>> indicates GNU/Linux but also have often used git on *BSD/Unix.  I'm not on
>> git mailing list but you can CC me all replies.
> When building software as the current user, the build artefacts are
> owned by this user.
Ownership, permissions are different: one can own files yet have zero 
permission to write/delete and be denied that.  After cloning, 
archiving, building most/all projects I tried from (hundreds/thousands) 
git commits I typically/always had zero permission to write/delete some 
files/directories within--despite owning--which led to more steps to 
delete and temptation to sudo 'rm -rf' (or preferably alias or script 
such as 'rm -RfI' (FreeBSD UNIX) or 'rm -rf --interactive=once' (GNU) 
but may not always be available).

> Are you building the software using Docker containers that run as root?
I don't use containers.  I noticed some projects' cmake & 'sudo make 
install' put root-owned files in build directory but doesn't seem to 
happen with other build systems--especially not plain make (BSD nor GNU 
nor with autotools)--still-used by almost all projects I try commits from.
         So, I don't think root is the problem; IIRC usually problem was 
cloned directories had one or more subdirectories (such as .git* or 
files/subdirectories further in those) that were/became user 
non-writeable so I ended up writing a bash function (on SlackWiki.com & 
docs.Slackware.com) to make git clones user-writable: should be by 
default (before & after building in .git*, etc.) and/or a 
well-documented beginner/easy option (is it even an option?) because 
surely many more people only test than commit.  Instructions say 'git 
clone URL' assuming someone will commit rather than only test and want 
to avoid user-non-writeable files (I doubt I even need .git* 
subdirectories until ever start committing (don't plan to: I only like 
decimal-numbered tarballs made manually rather than version control) so 
would rather opt-out).  I don't recall commits from three other/older 
major version control systems be(com)ing user non-writeable (though all 
less-used apart from on classic UNIX/*BSD I don't use much anymore 
besides servers but wish had more hardware support to be more 
desktop-useable).

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
       [not found]     ` <CAPx1Gvc6ci1CjhL-zjwqkR=4o2yQTrT0V_Hb9bUBNuaBn47M8A@mail.gmail.com>
@ 2022-07-23  0:25       ` David Chmelik
  2022-07-23  3:54         ` Chris Torek
  0 siblings, 1 reply; 8+ messages in thread
From: David Chmelik @ 2022-07-23  0:25 UTC (permalink / raw)
  To: git-l

On 7/22/22 10:40 AM, Chris Torek wrote:
> On Fri, Jul 22, 2022 at 6:24 AM David Chmelik <dchmelik@gmail.com 
> <mailto:dchmelik@gmail.com>> wrote:
>
>     Ownership, permissions are different: one can own files yet have zero
>     permission to write/delete and be denied that. ...
>
>
> All true.  But Git has no control over, or affect on these: Git does
> not attempt to affect ownership or permission of any build products
> at all.  Git only attempts to affect the execute permission of
> specific files as directed by the committed file mode (and provided
> `core.filemode` is enabled).
Not even projects' .git* subdirectories?  They typically are/become 
user-non-writable though deletable with several/many confirmations so I 
usually sudo (recommended against).  I'd rather opt-out of .git* 
subdirectories for every clone.

> [...] If you're using Samba/CIFS or other ACL-based file servers [...]
I don't know what those are (other than once tried Samba to transfer 
files between home PCs, not for compiling).

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
  2022-07-23  0:25       ` David Chmelik
@ 2022-07-23  3:54         ` Chris Torek
  2022-08-02 14:34           ` David Chmelik
  2022-08-09 11:05           ` David Chmelik
  0 siblings, 2 replies; 8+ messages in thread
From: Chris Torek @ 2022-07-23  3:54 UTC (permalink / raw)
  To: David Chmelik; +Cc: git-l

On Fri, Jul 22, 2022 at 5:29 PM David Chmelik <davidnchmelik@gmail.com> wrote:
> On 7/22/22 10:40 AM, Chris Torek wrote:
> > All true.  But Git has no control over, or affect on these: Git does
> > not attempt to affect ownership or permission of any build products
> > at all.  Git only attempts to affect the execute permission of
> > specific files as directed by the committed file mode (and provided
> > `core.filemode` is enabled).
> Not even projects' .git* subdirectories?  They typically are/become
> user-non-writable though deletable with several/many confirmations so I
> usually sudo (recommended against).

Ah, I thought you were (and I definitely was) talking only about the
*build products*. The stuff inside `.git` itself: some of that, Git does set
to non-writable. There is no need to use `sudo` though: a simple
"rm -rf .git" will blow away the Git repository itself.  However:

> I'd rather opt-out of .git* subdirectories for every clone.

In that case, *don't run `git clone in the first place*. The purpose of
`git clone` is to get you the entire repository. If you want a single working
tree, use `git archive` to make an archive from the commit you want,
and extract that archive to get the tree you want, without getting all
the *other* revisions.

Chris

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
  2022-07-22 13:23   ` David Chmelik
       [not found]     ` <CAPx1Gvc6ci1CjhL-zjwqkR=4o2yQTrT0V_Hb9bUBNuaBn47M8A@mail.gmail.com>
@ 2022-07-23  4:11     ` Đoàn Trần Công Danh
  1 sibling, 0 replies; 8+ messages in thread
From: Đoàn Trần Công Danh @ 2022-07-23  4:11 UTC (permalink / raw)
  To: davidnchmelik; +Cc: git-l

On 2022-07-22 06:23:05-0700, David Chmelik <dchmelik@gmail.com> wrote:
> On 7/17/22 4:06 AM, Beat Bolli wrote:
> > On Fri, Jul 15, 2022 at 03:35:49AM -0700, David Chmelik wrote:
> > > What did you do before the bug happened?
> > > 'git clone,' built various software (with gcc, BSD & GNU make, autotools,
> > > cmake, etc.)
> > > 
> > > What did you expect to happen?
> > > Option: keep cloned/built/etc. files user-writable.
> > > 
> > > What happened instead?
> > > Needed chmod or 'sudo rm -rf.'
> > > 
> > > What's different between what you expected and what actually happened?
> > > Option: keep cloned/built/etc. files user-writable, otherwise (has been said
> > > 15+ years) encourages 'sudo rm -rf.'
> > > 
> > > Anything else you want to add:
> > >          I try/test/debug (and report bugs) many software commits but don't
> > > commit so need cloned/built/etc. files writable as user & even system-wide
> > > options: who hasn't made 'rm -rf' mistakes? (unrelated but someone might
> > > claim is: I don't use non-UNIX-like OS that shell alias 'rm -rf' to confirm
> > > every file (potentially thousands) and though made my own alias (confirm
> > > once) it's longer, sometimes unavailable so don't always use (many people
> > > don't)... software should always have user-writable files option.)  Below
> > > indicates GNU/Linux but also have often used git on *BSD/Unix.  I'm not on
> > > git mailing list but you can CC me all replies.
> > When building software as the current user, the build artefacts are
> > owned by this user.
> Ownership, permissions are different: one can own files yet have zero
> permission to write/delete and be denied that.  After cloning, archiving,
> building most/all projects I tried from (hundreds/thousands) git commits I
> typically/always had zero permission to write/delete some files/directories
> within--despite owning--which led to more steps to delete and temptation to
> sudo 'rm -rf' (or preferably alias or script such as 'rm -RfI' (FreeBSD
> UNIX) or 'rm -rf --interactive=once' (GNU) but may not always be available).
> 
> > Are you building the software using Docker containers that run as root?
> I don't use containers.  I noticed some projects' cmake & 'sudo make
> install' put root-owned files in build directory but doesn't seem to happen

cmake & sudo make install

is your problem

cmake only generate a build system for your project.
After that, you need to run make to build its artifarts before running
(sudo) make install.

If you don't run `make` first, `make install` will trigger `make all`
implicitly, since `install` target depends on `all` target.
Thus, `sudo make install` will invoke some sort of equivalence of
`sudo make`, thus all build output will be owned by root.

So, there're nothing to do with git.


> with other build systems--especially not plain make (BSD nor GNU nor with
> autotools)--still-used by almost all projects I try commits from.
>         So, I don't think root is the problem; IIRC usually problem was
> cloned directories had one or more subdirectories (such as .git* or
> files/subdirectories further in those) that were/became user non-writeable
> so I ended up writing a bash function (on SlackWiki.com &
> docs.Slackware.com) to make git clones user-writable: should be by default
> (before & after building in .git*, etc.) and/or a well-documented
> beginner/easy option (is it even an option?) because surely many more people
> only test than commit.  Instructions say 'git clone URL' assuming someone
> will commit rather than only test and want to avoid user-non-writeable files
> (I doubt I even need .git* subdirectories until ever start committing (don't
> plan to: I only like decimal-numbered tarballs made manually rather than
> version control) so would rather opt-out).  I don't recall commits from
> three other/older major version control systems be(com)ing user
> non-writeable (though all less-used apart from on classic UNIX/*BSD I don't
> use much anymore besides servers but wish had more hardware support to be
> more desktop-useable).

-- 
Danh

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
  2022-07-23  3:54         ` Chris Torek
@ 2022-08-02 14:34           ` David Chmelik
  2022-08-09 11:05           ` David Chmelik
  1 sibling, 0 replies; 8+ messages in thread
From: David Chmelik @ 2022-08-02 14:34 UTC (permalink / raw)
  To: git-l

On 7/22/22 8:54 PM, Chris Torek wrote:
> On Fri, Jul 22, 2022 at 5:29 PM David Chmelik<davidnchmelik@gmail.com>  wrote:
>> On 7/22/22 10:40 AM, Chris Torek wrote:
>>> All true.  But Git has no control over, or affect on these: Git does
>>> not attempt to affect ownership or permission of any build products
>>> at all.  Git only attempts to affect the execute permission of
>>> specific files as directed by the committed file mode (and provided
>>> `core.filemode` is enabled).
>> Not even projects' .git* subdirectories?  They typically are/become
>> user-non-writable though deletable with several/many confirmations so I
>> usually sudo (recommended against).
> Ah, I thought you were (and I definitely was) talking only about the
> *build products*. The stuff inside `.git` itself: some of that, Git does set
> to non-writable.
Initially wasn't; don't know why took three replies to clear up 
(initially clearly specified non-root usage which others ignored and 
mentioned/focused unrelated root topic).

> There is no need to use `sudo` though: a simple
> "rm -rf .git" will blow away the Git repository itself.  However:
Still fewer confirmations with sudo (one rather than every single 
user-non-writable file).

>> I'd rather opt-out of .git* subdirectories for every clone.
> In that case, *don't run `git clone in the first place*. The purpose of
> `git clone` is to get you the entire repository. If you want a single working
> tree, use `git archive` to make an archive from the commit you want,
> and extract that archive to get the tree you want, without getting all
> the *other* revisions.
Seems much more complicated (and less-documented) and most popular git 
sites (though the #1 isn't Free/Libre/Opensource Software (FLS, OSS, 
FOSS, FLOSS) so is condemned) allow clone but not archive.  I know you 
can't control their mistakes and they should be irrelevant 
(unfortunately most projects use most popular/broken sites) but couldn't 
there be more (detailed and/or easier) syntax?

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

* Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
  2022-07-23  3:54         ` Chris Torek
  2022-08-02 14:34           ` David Chmelik
@ 2022-08-09 11:05           ` David Chmelik
  1 sibling, 0 replies; 8+ messages in thread
From: David Chmelik @ 2022-08-09 11:05 UTC (permalink / raw)
  To: git-l

On 7/22/22 8:54 PM, Chris Torek wrote:
> On Fri, Jul 22, 2022 at 5:29 PM David Chmelik<davidnchmelik@gmail.com> 
> wrote:
>> On 7/22/22 10:40 AM, Chris Torek wrote:
>>> All true. But Git has no control over, or affect on these: Git does
>>> not attempt to affect ownership or permission of any build products
>>> at all. Git only attempts to affect the execute permission of
>>> specific files as directed by the committed file mode (and provided
>>> `core.filemode` is enabled).
>> Not even projects' .git* subdirectories? They typically are/become
>> user-unwritable though deletable with several/many confirmations so I
>> usually sudo (recommended against).
> Ah, I thought you were (and I definitely was) talking only about the
> *build products*. The stuff inside `.git` itself: some of that, Git 
> does set
> to unwritable.
Initially wasn't; don't know why took three replies to clear up 
(initially clearly specified non-root usage which others ignored and 
mentioned/focused unrelated root topic).

> There is no need to use `sudo` though: a simple
> "rm -rf .git" will blow away the Git repository itself. However:
Starts with 'rm -rf .' which is bad and worse is one key away from 'rm 
-rf /': anyone who accidentally pressed <ENTER> after either what I put 
in quotation marks (I did both as root on my personal files and entire 
PC in 1990s... have you ever?  It was normal to use root account then 
rather than non-UNIX-like OS that lock it) wants to never again so 
typically uses alias which done with sudo (still considered worst last 
resort) still has fewer confirmations (one rather than every single 
user-unwritable file). I can't believe I'm asking to encourage avoid 'rm 
-rf', on mailing list of a tool on UNIX/GNU/Linux (POSIX-based) 
operating systems, original which people started avoiding 'rm -rf' in 
1970s, but now people say just do it!

>> I'd rather opt-out of .git* subdirectories for every clone.
> In that case, *don't run `git clone in the first place*. The purpose of
> `git clone` is to get you the entire repository. If you want a single 
> working
> tree, use `git archive` to make an archive from the commit you want,
> and extract that archive to get the tree you want, without getting all
> the *other* revisions.
Seems much more complicated (and less-documented) and most popular git 
sites (though #1 isn't Free/Libre/Opensource Software (FLS, OSS, FOSS, 
FLOSS) so rightly condemned) disallow archive.  Though I my shell alias 
rewrites 'git clone' to then 'chmod u+w .git*' or alternatively 'find . 
-iname .git* -perm u-w -exec chmod u+w {} \+' and usually before 
archiving, 'sudo rm -rf .git*', aliases are sometimes unavailable and 
now a few projects won't compile without such directories.  I know you 
can't control popular sites' mistakes (nor projects never doing 
normally-numbered releases) and they should be irrelevant: unfortunately 
most projects use most popular/broken sites, sadly including core 
component projects for some/most/all POSIX-based OSs, so couldn't syntax 
be easier/detailed so testers can opt-out user-unwritables (for 
thousands/millions major cases archive disallowed)?
         Apparently many/all version control systems (VCS) make such 
(initially) user-unwritables so may consider this request odd but for 
tester-only people, it's not odd to dislike such we don't use (unless 
ever changes... I've used VCS last  11+ years (likely since late 1990s 
or early '0s) and don't plan to use .git* & etc. decades into 
foreseeable future but in very-slight chance I do presumably such 
files/directories would be useful... for now I've spent hours/days over 
decades in frustration: 11+ years ago when projects had a minor bug said 
'try from VCS (nightly)' I was glad but led to nightly/critical bugs and 
user-unwritables... VCS are a godsend for decreasing years update waits 
but (as with most science/technology) have advantages & disadvantages...)
--D


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

end of thread, other threads:[~2022-08-09 11:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-15 10:35 'git clone,' build makes user non-writable files (should be option keep user-writable) David Chmelik
2022-07-17 11:21 ` Beat Bolli
     [not found] ` <YtPtQ6qsIviyTBF2@zbox.drbeat.li>
2022-07-22 13:23   ` David Chmelik
     [not found]     ` <CAPx1Gvc6ci1CjhL-zjwqkR=4o2yQTrT0V_Hb9bUBNuaBn47M8A@mail.gmail.com>
2022-07-23  0:25       ` David Chmelik
2022-07-23  3:54         ` Chris Torek
2022-08-02 14:34           ` David Chmelik
2022-08-09 11:05           ` David Chmelik
2022-07-23  4:11     ` Đoàn Trần Công Danh

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).