Opened 6 years ago

Last modified 2 years ago

#1525 assigned bug

create_needed_dirs() should not try to create anything under /usr or /etc

Reported by: SaThaRiel Owned by: magnate
Milestone: Future Keywords: unix
Cc:

Description (last modified by nckmccnnll)

Hi,

the current dev version (git) doesnt compile correctly on Linux x86_64. I will attach the log from the build - a binary is created but it seems that the lib directory isnt setup completely.

Checkout is done this way:

git clone http://github.com/angband/angband.git

Build is done this way:

  CFLAGS=""
  ./autogen.sh
  ./configure \
    --prefix=/usr \
    --bindir=/usr/bin/ \
    --sysconfdir=/usr/share/angband \
    --with-configpath=/usr/share/angband \
    --with-libpath=/usr/share/angband \
    --enable-gtk \
    --enable-sdl \
    --enable-sdl-mixer
  make clean
  make
  make DESTDIR="$pkgdir" install

Sure, $pkgdir is set.

I tried a local, existing git repository and also did a fresh checkout.

Must check this later on x86 too.

gcc version

gcc (GCC) 4.6.1 20110819 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Cheers

SaThaRiel?

Attachments (1)

build.log (11.1 KB) - added by SaThaRiel 6 years ago.

Download all attachments as: .zip

Change History (15)

Changed 6 years ago by SaThaRiel

comment:1 Changed 6 years ago by magnate

Could this be a duplicate of #1522? If you configure --with-no-install, does it build and run in situ?

comment:2 Changed 6 years ago by SaThaRiel

Yes - if i build it without prefix and --with-no-install i can run it.

Btw. built and installed with the "usual" flags gives the following error:

angband: Cannot create '/usr/share/angband/info'

No idea - maybe the info directory is created when angband is started for the first time and it doesnt exist? A normal user can't create directories under /usr/.../. But i dont want to run it as root ;)

Hope this helps. I remember that i run into this bug before - but maybe not with angband but another variant...

comment:3 Changed 6 years ago by magnate

  • Keywords unix added
  • Milestone changed from 3.4.0 to 3.3.1
  • Owner set to magnate
  • Status changed from new to assigned
  • Summary changed from Angband compilation problem on Linux x86_64 to create_needed_dirs() should not try to create anything under /usr or /etc

Ok, I'm re-naming this ticket to address the directory-creation issue, as the original build problem is covered by #1522.

I think I know why the dir problem is happening, it's because we now call create_needed_dirs() early on to ensure that any missing directories are created. This of course doesn't play nice with system-wide installs - in those cases it should only be trying to create dirs under ~/.angband/Angband - I'll check this.

comment:4 Changed 6 years ago by SaThaRiel

Maybe its a better idea to create those directories when options like --prefix are used. When using a user install with --with-no-install they can be created on demand.

The creation was done until - at least - 6th of august. After this it was changed (no direct date) and since then the build worked but came up with the error above. The lib tree is missing completely when using make install (maybe this is just the problem...).

Since i am using this to build a package i know that the usual install took around 9.24MB while the actual package would only install 1.29MB.

comment:5 Changed 6 years ago by magnate

Yes, the build system was updated around 6th August, which is where the error in #1522 comes from. It sounds as if we should fix that first, and then see if the directory creation issue still happens - maybe it won't.

comment:6 Changed 6 years ago by magnate

Oh bother. Currently there is no way to tell inside the code whether setgid is being used. The gid which is set during configure is stored only in mk/extra.mk, and is not accessible inside the code.

Maybe there is a better way to check for whether we're running as a setgid install? At the moment player_egid is set in main.c but we don' t know whether it's from the player themself or from the game's setgid bit.

Or we could hack about trying to interrogate configpath/libpath/varpath and guess when we shouldn't be creating dirs? Doesn't sound like the right approach.

Or maybe we just leave it as it is, and allow it to fail intelligently when it doesn't have permission to create the dirs? We could just add the creation of the empty dirs to the setgid path through make install.

comment:7 Changed 6 years ago by takkaria

The compile-time flag is SET_UID, it is accessible from inside the game.

comment:8 Changed 6 years ago by magnate

Er ... doesn't SET_UID just mean "we are on a POSIX system"? Does it actually mean "we are running with setgid"?

comment:9 Changed 6 years ago by takkaria

Yeah, you're right, sorry. The way to tell if you're running setgid is: (SET_UID and not USE_PRIVATE_PATHS). We should probably look at changing the name of SET_UID.

comment:10 Changed 6 years ago by magnate

  • Milestone changed from 3.3.1 to 3.4.0
  • Status changed from assigned to confirmed

Punting to 3.4 as this may need some untangling. Ironically I will probably make progress on this while building the debian package of 3.3.1 after it's released.

comment:11 Changed 5 years ago by magnate

  • Status changed from confirmed to assigned

comment:12 Changed 5 years ago by magnate

  • Milestone changed from 3.4.0 to 3.5.0

Moved to 3.5.0 with a genuine intention to fix them by then.

comment:13 Changed 3 years ago by nckmccnnll

  • Description modified (diff)
  • Milestone changed from Future to 4.0

Setting this to 4.0 - I suspect it may be done already

comment:14 Changed 2 years ago by nckmccnnll

  • Milestone changed from 4.0 to Future

Dunno, so setting back to future

Note: See TracTickets for help on using tickets.