Skip to content

duc.c: Create ~/.cache if needed#296

Closed
licy183 wants to merge 1 commit into
zevv:masterfrom
licy183:master
Closed

duc.c: Create ~/.cache if needed#296
licy183 wants to merge 1 commit into
zevv:masterfrom
licy183:master

Conversation

@licy183
Copy link
Copy Markdown

@licy183 licy183 commented Jul 26, 2022

If ~/.cache doesn't exist, some error will happen. See termux/termux-packages#11350 (comment).

@l8gravely
Copy link
Copy Markdown
Collaborator

I'd merge this, but you need to handle errors better. If the mkdir() call fails, duc needs to error our more gracefully. I like the idea, but it needs some more work.

And apologies for the delay, now that v1.5.0-rc1 is about to come out, it would be great if you could re-spin this to address these issues.

@jmtd
Copy link
Copy Markdown
Contributor

jmtd commented Apr 1, 2026

Erm, 5da92b8 causes duc to fatally exit if the mkdir fails, which occurs if the directory already exists...

@jmtd jmtd mentioned this pull request Apr 1, 2026
@l8gravely
Copy link
Copy Markdown
Collaborator

Exactly! You need to check if the directory exists, or run mkdir() and check the return properly. I've already pushed a possible fix for this, but my brain is mush tonight and I still need to test stuff better.

@jmtd
Copy link
Copy Markdown
Contributor

jmtd commented Apr 15, 2026

I raised PR #356 to fix this a couple of weeks ago. Edit: oh no I didn't, I only fixed the related issue of failing if ~/.cache/duc already exists.

@l8gravely
Copy link
Copy Markdown
Collaborator

l8gravely commented Apr 16, 2026 via email

@jmtd
Copy link
Copy Markdown
Contributor

jmtd commented Apr 16, 2026

And I looked at it and I had some comments on how it was done.

thanks! I missed wherever those comments are, because they aren’t on the PR.

@l8gravely
Copy link
Copy Markdown
Collaborator

l8gravely commented Apr 20, 2026 via email

@jmtd
Copy link
Copy Markdown
Contributor

jmtd commented Apr 22, 2026

I updated PR #356 to address this issue now (the solution in this PR will fail if ~/.cache already exists). I still haven't found the earlier feedback so I don't know if that's still relevant. I'll keep looking.

@licy183
Copy link
Copy Markdown
Author

licy183 commented Apr 22, 2026

This PR ignores the return value of mkdir. While mkdir ~/.cache will indeed fail when ~/.cache exists, the program will still continue execution.

Regardless, the return value of mkdir should be handled properly, so I will close this PR and lean towards #356.

@licy183 licy183 closed this Apr 22, 2026
@jmtd
Copy link
Copy Markdown
Contributor

jmtd commented Apr 23, 2026

This PR ignores the return value of mkdir. While mkdir ~/.cache will indeed fail when ~/.cache exists, the program will still continue execution.

Good point. Sorry

@l8gravely
Copy link
Copy Markdown
Collaborator

l8gravely commented Apr 29, 2026 via email

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.

3 participants