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

fix: Add stdout validation when setting logging output path #666

Merged
merged 2 commits into from
Jul 26, 2022

Conversation

fredcarle
Copy link
Collaborator

Relevant issue(s)

Resolves #665

Description

This PR fixes the outpath validation for the logging package. It ensures an stdout file isn't created during validation.

Tasks

  • I made sure the code is well commented, particularly hard-to-understand areas.
  • I made sure the repository-held documentation is changed accordingly.
  • I made sure the pull request title adheres to the conventional commit style (the subset used in the project can be found in tools/configs/chglog/config.yml).
  • I made sure to discuss its limitations such as threats to validity, vulnerability to mistake and misuse, robustness to invalidation of assumptions, resource requirements, ...

How has this been tested?

manual testing

Specify the platform(s) on which this was tested:

  • MacOS

@fredcarle fredcarle added bug Something isn't working area/logging Related to the logging/logger system action/no-benchmark Skips the action that runs the benchmark. labels Jul 26, 2022
@fredcarle fredcarle added this to the DefraDB v0.3 milestone Jul 26, 2022
@fredcarle fredcarle requested a review from a team July 26, 2022 00:15
@fredcarle fredcarle self-assigned this Jul 26, 2022
validatedPaths = append(validatedPaths, p)
continue
}

if f, err := os.OpenFile(p, os.O_CREATE|os.O_APPEND, 0666); err != nil {
if f, err := os.OpenFile(p, os.O_CREATE|os.O_APPEND, 0644); err != nil {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@orpheuslummis I hope this makes you happy.

Copy link
Contributor

Choose a reason for hiding this comment

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

making the codebase accessible even to the superstitious

Copy link
Member

Choose a reason for hiding this comment

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

WOW and this is PR # 666

Copy link
Member

Choose a reason for hiding this comment

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

Illuminati confirmed?

Copy link
Contributor

Choose a reason for hiding this comment

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

can't escape 666

Copy link
Member

Choose a reason for hiding this comment

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

  • queue X-Files theme*

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this is hilarious!!!!!

Copy link
Member

Choose a reason for hiding this comment

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

  • queue X-Files theme

This played in my mind while I read this.

@codecov
Copy link

codecov bot commented Jul 26, 2022

Codecov Report

Merging #666 (6fd2326) into develop (9d4a333) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff            @@
##           develop     #666   +/-   ##
========================================
  Coverage    61.68%   61.68%           
========================================
  Files          123      123           
  Lines        14925    14925           
========================================
  Hits          9206     9206           
  Misses        4859     4859           
  Partials       860      860           
Impacted Files Coverage Δ
logging/config.go 75.69% <100.00%> (ø)
logging/logger.go 74.83% <100.00%> (ø)

@shahzadlone shahzadlone mentioned this pull request Jul 26, 2022
4 tasks
Copy link
Member

@jsimnz jsimnz left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Member

@shahzadlone shahzadlone left a comment

Choose a reason for hiding this comment

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

Merged this onto #659 and can confirm that the file creation doesn't happen anymore! Thanks for the quick fix.

@orpheuslummis
Copy link
Contributor

I wonder does that need to touch willOutputToStderr as well ?

@fredcarle
Copy link
Collaborator Author

I wonder does that need to touch willOutputToStderr as well ?

nice catch

@fredcarle fredcarle merged commit c3d4517 into develop Jul 26, 2022
@fredcarle fredcarle deleted the fredcarle/fix/logging-stdout-file-creation branch July 26, 2022 00:37
shahzadlone pushed a commit to shahzadlone/defradb that referenced this pull request Feb 23, 2024
…twork#666)

Relevant issue(s)
Resolves sourcenetwork#665

Description
This PR fixes the outputPath validation for the logging package. It ensures an stdout file isn't created during validation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/no-benchmark Skips the action that runs the benchmark. area/logging Related to the logging/logger system bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging package created stdout file on file validation
4 participants