Fix /tix/manifest permissions in installations.

This commit is contained in:
Jonas 'Sortie' Termansen 2020-12-27 22:48:27 +01:00
parent 5f84c38bc8
commit 29598b4fde
4 changed files with 42 additions and 2 deletions

View File

@ -69,6 +69,13 @@ releasing Sortix x.y, foo." to allow the maintainer to easily
.Xr grep 1
for it after a release.
.Sh CHANGES
.Ss Fix /tix/manifest permissions in installations
The
.Pa /tix/manifest
directory was accidentally installed by
.Xr sysinstall 8
as mode 6603 instead of 7555.
This problem is fixed with an upgrade hook.
.Ss Add socket(2)
The
.Pa /dev/net

View File

@ -51,6 +51,7 @@ install: all
mkdir -p $(DESTDIR)$(DATADIR)/sysinstall/hooks
# TODO: After releasing Sortix 1.1, remove this compatibility.
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-random-seed
touch $(DESTDIR)$(DATADIR)/sysinstall/hooks/sortix-1.1-tix-manifest-mode
sysinstall: $(SYSINSTALL_OBJS)
$(CC) $(SYSINSTALL_OBJS) -o $@ -lmount

View File

@ -17,6 +17,7 @@
* Upgrade hooks.
*/
#include <sys/stat.h>
#include <sys/types.h>
#include <err.h>
@ -94,6 +95,37 @@ void upgrade_prepare(const struct release* old_release,
}
free(random_seed_path);
}
// TODO: After releasing Sortix 1.1, remove this compatibility.
if ( hook_needs_to_be_run(source_prefix, target_prefix,
"sortix-1.1-tix-manifest-mode") )
{
// The mode of /tix/manifest was accidentally set to 7555 (decimal)
// instead of 0755 (octal) in sysinstall.c, i.e. mode 06603. Fix it to
// 0755.
char* path = join_paths(target_prefix, "/tix/manifest");
if ( !path )
{
warn("malloc");
_exit(2);
}
struct stat st;
if ( stat(path, &st) < 0 )
{
warn("%s", path);
_exit(2);
}
if ( (st.st_mode & 07777) == (7555 & 07777) )
{
printf(" - Fixing /tix/manifest permissions...\n");
if ( chmod(path, 0755) < 0 )
{
warn("chmod: %s", path);
_exit(2);
}
}
free(path);
}
}
void upgrade_finalize(const struct release* old_release,

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2016 Jonas 'Sortie' Termansen.
* Copyright (c) 2015, 2016, 2020 Jonas 'Sortie' Termansen.
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
@ -900,7 +900,7 @@ int main(void)
mkdir_or_chmod_or_die("sbin", 0755);
mkdir_or_chmod_or_die("share", 0755);
mkdir_or_chmod_or_die("tix", 0755);
mkdir_or_chmod_or_die("tix/manifest", 7555);
mkdir_or_chmod_or_die("tix/manifest", 0755);
mkdir_or_chmod_or_die("tmp", 01777);
mkdir_or_chmod_or_die("var", 0755);
mkdir_or_chmod_or_die("var/empty", 0555);