GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fixed #342/fixed #343 - do not treat directories like regular files in existence checks by firewave · Pull Request #339 · cppcheck-opensource/simplecpp

Conversation

@firewave

@firewave firewave commented Feb 15, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

std::ifstream can open directories and read from them without issue. Nothing will be read though - it is like an empty file. This would have treated an include which actually pointed to a directory as existing (e.g. #include </>).

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@firewave

firewave commented Feb 15, 2024

Copy link
Copy Markdown
Collaborator Author

No tests added since we still do not have tests for additional files ... but I just realized that certain directories always exists so at least on Linux it can be tested.

Moving code is problematic though as Cppcheck is GPL and this would re-license it under 0BSD.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave
firewave force-pushed the inc branch 5 times, most recently from 3ead71c to fa994a3 Compare February 17, 2024 00:49
@firewave firewave mentioned this pull request Feb 17, 2024
refs #342 - do not load included files twice in CLI application / added DUI::removeComment #340
Merged
@firewave firewave mentioned this pull request May 3, 2024
made it possible to create a TokenList from a buffer #347
Merged
@firewave
firewave force-pushed the inc branch from fa994a3 to 5bacce1 Compare May 24, 2024 06:55
@firewave

firewave commented May 24, 2024

Copy link
Copy Markdown
Collaborator Author

Moving code is problematic though as Cppcheck is GPL and this would re-license it under 0BSD.

@danmar

After we resolved and merged this we should create another release so we can sync it to Cppcheck.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@firewave firewave mentioned this pull request May 27, 2024
Make ofstreams thow exception on write issues cppcheck-opensource/cppcheck#5255
Draft
@firewave firewave mentioned this pull request Oct 21, 2024
fix header file search issue cppcheck-opensource/cppcheck#6939
Closed
@firewave
firewave force-pushed the inc branch from 5bacce1 to 779a986 Compare August 5, 2025 14:53
@firewave firewave changed the title do not treat directories like regular files in existence checks fixed #342/#343 - do not treat directories like regular files in existence checks Aug 5, 2025
@firewave

firewave commented Aug 15, 2025

Copy link
Copy Markdown
Collaborator Author

The helper functions need to be adjusted so they align with the current usage in Cppcheck.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

firewave added 3 commits August 23, 2025 14:58
@firewave
added the file/directory existence functions from Cppcheck
95d8b17
@firewave
do not treat directories like regular files in existence checks
85704d6
@firewave
test.cpp: added test to make sure the leak with empty headers no long…
8a9eb08
…er occurs
@firewave
firewave force-pushed the inc branch from 779a986 to 8a9eb08 Compare August 23, 2025 12:58
This was referenced Sep 10, 2025
fix #381 #382
Closed
main.cpp: error out when file/path provided by -I or -include=, or the input does not exist #435
Merged
@firewave firewave changed the title fixed #342/#343 - do not treat directories like regular files in existence checks fixed #342/fixed #343 - do not treat directories like regular files in existence checks Oct 1, 2025
@firewave firewave mentioned this pull request Dec 14, 2025
refs #341 - added fuzzing client #351
Draft
This was linked to issues Jun 2, 2026
#include pointing to directory is treated as existing empty file #343
Open
memory leak when processing empty/non-existent includes with simplecpp CLI #342
Open
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

#include pointing to directory is treated as existing empty file memory leak when processing empty/non-existent includes with simplecpp CLI

Uh oh!

There was an error while loading. Please reload this page.

1 participant

@firewave
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.