Skip to content

Conversation

@navi-desu
Copy link
Member

No description provided.

@navi-desu navi-desu force-pushed the tests branch 2 times, most recently from f5d974b to 725d92b Compare April 12, 2025 19:43
Copy link
Contributor

@N-R-K N-R-K left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like tests. I don't like how testing specific hacks (--root, $RC_ROOT) are bleeding into regular builds though.

free(rc_dirs.svcdir);
for (size_t i = 0; i < ARRAY_SIZE(scriptdirs); i++)
if (rc_dirs.scriptdirs_data[i])
free(rc_dirs.scriptdirs_data[i]);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check is pretty useless since free(NULL) is no-op. I'd also set it back to NULL after free(), that's what the rest is doing.

{
int len = strlen(root);
if (root[len - 1] == '/')
len--;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't work for "/", besides, it's unnecessary anyways isn't it? Multiple slashes in path are redundant but don't cause any issue. But if you want to strip trailing slashes, then here's the proper way to do it (note len>1 rather then len>0):

while (len > 1 && root[len-1] == '/') len--;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's unnecessary though i just find foo//nya ugly, and that would propagate to the symlinks created...

and i now i wonder if the symlinks (rc-update add, del) should be relative, since trying to use --root to build a chroot would give broken symlinks as is right now

const char *applet = NULL;
const char *extraopts = "stop | start | restart | status | describe | zap";
const char getoptstring[] = "dDsSvl:Z" getoptstring_COMMON;
const char getoptstring[] = "dDsSvl:Z" getoptstring_DIRS getoptstring_COMMON;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since --root is only for testing purposes, shouldn't we try to use something less invasive?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not just for testing purposes, another use of it is to setup a chroot, image, etc, which is a feature i really missed while setting up my laptop and trying to build gentoo for arm

Copy link
Contributor

@thesamesam thesamesam Apr 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. People have been wanting this for quite some time, even.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, that makes sense. But in that case, the commit messages should document it more clearly. Since the PR title was about adding tests, I assumed this would only be used for testing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i realized --root doesn't make much sense for rc-service (is there any valid case to start a service from a chroot... from outside it?)

maybe we keep RC_ROOT internally, but only expose --root for rc-update?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of some contrived cases for rc-status --root but they don't make much sense or are very unlikely, e.g. some /run inside the root that isn't a tmpfs.

@navi-desu navi-desu force-pushed the tests branch 3 times, most recently from a239c71 to 2b0a669 Compare August 31, 2025 00:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants