Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't write back .htaccess file on a RO filesystem #42298

Merged
merged 1 commit into from Dec 19, 2023
Merged

Conversation

solracsf
Copy link
Member

Checklist

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf solracsf added the 3. to review Waiting for reviews label Dec 15, 2023
@solracsf solracsf added this to the Nextcloud 29 milestone Dec 15, 2023
@solracsf solracsf requested review from a team, ArtificialOwl, icewind1991 and Altahrim and removed request for a team December 15, 2023 08:24
@susnux susnux requested a review from come-nc December 17, 2023 12:43
@come-nc
Copy link
Contributor

come-nc commented Dec 18, 2023

Shouldn’t we at least log something? Not being able to update the htaccess has consequences, no?

@solracsf
Copy link
Member Author

solracsf commented Dec 18, 2023

We can, but here we're dealing with RO filesystems mainly, that are updated otherwise.

In RW filesystems, it will throw and log here (but also don't write or log in some cases, see line 571):

if ($content !== '') {
// Never write file back if disk space should be too low
if (function_exists('disk_free_space')) {
$df = disk_free_space(\OC::$SERVERROOT);
$size = strlen($content) + 10240;
if ($df !== false && $df < (float)$size) {
throw new \Exception(\OC::$SERVERROOT . " does not have enough space for writing the htaccess file! Not writing it back!");
}
}
//suppress errors in case we don't have permissions for it
return (bool)@file_put_contents($setupHelper->pathToHtaccess(), $htaccessContent . $content . "\n");
}

@Pilzinsel64
Copy link

Would be cool to get (backports of this) into the next minor updates for 28 and 27 if applicable, so we can push the latest security fixes to our users. :) nextcloud-snap/nextcloud-snap#2631 (comment)

@stondino00
Copy link

Any way we can patch this on 27.1.5 for the snap rather than waiting until the backport in 27.1.6? Thanks

@solracsf solracsf merged commit 5077d0a into master Dec 19, 2023
50 checks passed
@solracsf solracsf deleted the readOnlyFSFalse branch December 19, 2023 20:34
@solracsf
Copy link
Member Author

/backport to stable28

@solracsf
Copy link
Member Author

/backport to stable27

@kyrofa
Copy link
Member

kyrofa commented Dec 19, 2023

Any way we can patch this on 27.1.5 for the snap rather than waiting until the backport in 27.1.6? Thanks

I don't believe we can do that without violating the integrity checks. We're going to have to wait for 27.1.6.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: occ maintenance:install fails on read-only htdocs directory
6 participants