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

Escape unix socket group in unit tests #1554

Merged
merged 1 commit into from
Jan 14, 2025
Merged

Conversation

secwall
Copy link
Contributor

@secwall secwall commented Jan 13, 2025

In some cases unix groups could have whitespace and/or \ in them.
One example is my workstation. It's a MacOS in an Active Directory domain. So my user has group LD\Domain Users.
Running make test on unstable and 8.0 branches fails with:

*** FATAL CONFIG FILE ERROR (Version 8.0.2) ***
Reading the configuration file, at line 30
>>> 'unixsocketgroup LD\Domain Users'
wrong number of arguments

I'm not sure if we need to fix this in 8.0. But it seems that it should be fixed in unstable.

Copy link

codecov bot commented Jan 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70.78%. Comparing base (d13aad4) to head (c45bcf1).
Report is 1 commits behind head on unstable.

Additional details and impacted files
@@             Coverage Diff              @@
##           unstable    #1554      +/-   ##
============================================
- Coverage     70.94%   70.78%   -0.16%     
============================================
  Files           120      120              
  Lines         65044    65044              
============================================
- Hits          46143    46039     -104     
- Misses        18901    19005     +104     

see 15 files with indirect coverage changes

@madolson
Copy link
Member

Agree, don't think we need to backport it.

@madolson madolson merged commit fdc89c5 into valkey-io:unstable Jan 14, 2025
49 checks passed
@@ -568,7 +568,8 @@ if {$::verbose} {
set tempFileId [open $tempFileName w]
set group [dict get [file attributes $tempFileName] -group]
if {$group != ""} {
start_server [list tags {"repl external:skip"} overrides [list unixsocketgroup $group unixsocketperm 744]] {
set escaped_group "\"[string map {"\\" "\\\\"} $group]\""
start_server [list tags {"repl external:skip"} overrides [list unixsocketgroup $escaped_group unixsocketperm 744]] {
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't it be more correct to do the escaping inside start_server so it works everywhere and for all options?

(proc start_server is defined in tests/support/server.tcl.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Probably yes. Do we have a list of all string options that we should escape?
Could we try to escape any string option if we don't have such list?

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't know. :) I think some investigation is needed to find out the best solution here. Now it's already merged so let's not worry too much about it.

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