Coder Social home page Coder Social logo

juur / tmpfilesd Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 1.0 103 KB

A re-implementation of tmpfilesd outwith systemd for Linux like operating systems.

License: MIT License

Makefile 4.37% Shell 2.10% C 93.44% Vim Script 0.08%
linux systemd sysvinit

tmpfilesd's Introduction

tmpfilesd

About

tmpfilesd is a replacement for systemd-tmpfiles that does not require systemd and includes support for sysvinit style enviroments

Building

From source:

./configure && make

From the source, for RHEL/CentOS:

./configure && make dist && rpmbuild -ta tmpfilesd*.tar.gz

References

Uses some code from https://github.com/troglobit/libite, specifically: mkpath().

CodeQL Build

tmpfilesd's People

Contributors

juur avatar orbea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

orbea

tmpfilesd's Issues

mknod fails to create directories

On my system when starting tmpfilesd I receive this output.

 * Create Static Devices Nodes in /dev ...
tmpfilesd: CREATE_CHAR/BLK: mknod(/dev/net/tun): No such file or directory
tmpfilesd: CREATE_CHAR/BLK: mknod(/dev/snd/timer): No such file or directory
tmpfilesd: CREATE_CHAR/BLK: mknod(/dev/snd/seq): No such file or directory

The init command is:

tmpfilesd --prefix=/dev --create --boot

Where the init script which is basically a copy of the systemd version is:

#!/sbin/openrc-run
# Copyright 2023 Gentoo Authors
# Released under the MIT license.

description="Create Static Devices Nodes in /dev"

depend()
{
	provide tmpfiles-dev tmpfiles.dev
	use dev-mount
	before dev
	keyword -prefix -vserver
}

start()
{
	ebegin "${description}"
	tmpfilesd --prefix=/dev --create --boot
	eend $?
}

It seems to me its not capable of creating directories recursively? For example if I manually rerun the command the /dev/snd/ directory now exists so /dev/net/seq gets created while /dev/net/ does not exist so I still recieve the /dev/net/tun error.

Release tags?

I am not sure what level of support you want for this repo, but is it possible to make a release tag for easier integration into distros?

free(): invalid pointer

Not sure why I didn't notice this earlier, but when these directories do not exist there are invalid uses of free().

# tmpfilesd --create --remove --boot --exclude-prefix=/dev 
tmpfilesd: process_folder: opendir: </etc/tmpfiles.d>: No such file or directory
free(): invalid pointer
The process was killed by SIGABRT: Aborted

This seems to be from main.c.

tmpfilesd/src/main.c

Lines 2135 to 2149 in 6073d17

/* TODO move these to constants somewhere e.g. config.h */
if ((tmppath = pathcat(opt_root, "/etc/tmpfiles.d")) == NULL)
err(EXIT_FAILURE, "main: pathcat");
process_folder(tmppath);
free(tmppath);
if ((tmppath = pathcat(opt_root, "/run/tmpfiles.d")) == NULL)
err(EXIT_FAILURE, "main: pathcat");
process_folder(tmppath);
free(tmppath);
if ((tmppath = pathcat(opt_root, "/usr/lib/tmpfiles.d")) == NULL)
err(EXIT_FAILURE, "main: pathcat");
process_folder(tmppath);
free(tmppath);

What should be installed in /etc/tmpfiles.d? On my system the installed package contains:

 * Contents of sys-apps/tmpfilesd-9999:
/bin
/bin/tmpfilesd
/etc
/etc/conf.d
/etc/conf.d/tmpfilesd-dev
/etc/conf.d/tmpfilesd-setup
/etc/cron.daily
/etc/cron.daily/tmpfilesd-clean
/etc/init.d
/etc/init.d/tmpfilesd-dev
/etc/init.d/tmpfilesd-setup
/usr
/usr/lib
/usr/lib/tmpfiles.d
/usr/lib/tmpfiles.d/tmp.conf
/usr/lib/tmpfiles.d/var.conf
/usr/share
/usr/share/doc
/usr/share/doc/tmpfilesd-9999
/usr/share/doc/tmpfilesd-9999/README.md.gz
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/tmpfilesd.8.gz

I am not seeing config files installed in /etc/tmpfiles.d/, should it be changed to /lib/tmpfiles.d?

$(CP) $(srcdir)/misc/tmpfiles-d/*.conf $(DESTDIR)$(prefix)/lib/tmpfiles.d/

main.c: Many warnings with 13.2.1

With gcc-13.2.1 on my Gentoo system using musl-1.2.4 there are many warnings in main.c.

src/main.c: In function 'vet_age':
src/main.c:414:30: warning: format '%u' expects argument of type 'unsigned int *', but argument 3 has type 'int *' [-Wformat=]
  414 |         read = sscanf(src, "%u%ms", &ret, &tmp);
      |                             ~^      ~~~~
      |                              |      |
      |                              |      int *
      |                              unsigned int *
      |                             %u
src/main.c:414:28: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
  414 |         read = sscanf(src, "%u%ms", &ret, &tmp);
      |                            ^~~~~~~
src/main.c: In function 'process_line':
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
  644 |                         "%ms %ms %ms %ms %ms %ms %m[^\n]s",
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:644:25: warning: ISO C does not support the 'm' scanf flag [-Wformat=]
src/main.c:813:78: warning: operand of '?:' changes signedness from 'int' to 'uid_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  813 |                                                 if (chown(globs[i], defuid ? -1 : uid,
      |                                                                              ^~
src/main.c:814:82: warning: operand of '?:' changes signedness from 'int' to 'gid_t' {aka 'unsigned int'} due to unsignedness of other operand [-Wsign-compare]
  814 |                                                                         defgid ? -1 : gid))
      |                                                                                  ^~
src/main.c:768:41: warning: 'strncpy' specified bound 4096 equals destination size [-Wstringop-truncation]
  768 |                                         strncpy(ignores[ignores_size].path, globs[i], PATH_MAX);
      |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

With clang-16.0.6 there are no warnings however.

Assuming you are interested, you might be in a better position to fix these warnings given your familiarity with the code.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.