git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Đoàn Trần Công Danh" <congdanhqx@gmail.com>
To: davidnchmelik@gmail.com
Cc: git-l <git@vger.kernel.org>
Subject: Re: 'git clone,' build makes user non-writable files (should be option keep user-writable)
Date: Sat, 23 Jul 2022 11:11:32 +0700	[thread overview]
Message-ID: <Ytt09IrDyEQDc3Z3@danh.dev> (raw)
In-Reply-To: <158251f2-9fa4-45b7-4c24-907c94602b6e@gmail.com>

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

      parent reply	other threads:[~2022-07-23  4:11 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Ytt09IrDyEQDc3Z3@danh.dev \
    --to=congdanhqx@gmail.com \
    --cc=davidnchmelik@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).