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

cli: fix overriding of the Timestamp container attribute #2985

Conversation

End-rey
Copy link
Contributor

@End-rey End-rey commented Oct 28, 2024

Closes #1339.

cmd/neofs-cli/modules/container/create.go Outdated Show resolved Hide resolved
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

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

there are also --name and --global-name attributty flags, they should be treated the same

also #1339 (comment) suggests to cover object attributes similarly within this issue, the current one is not enough to close the issue

cmd/neofs-cli/modules/container/create.go Show resolved Hide resolved
@End-rey End-rey force-pushed the 1339-undefined-behaviour-on-duplicated-container-attributes-when-using-neofs-cli branch from a4f192d to 25c2b07 Compare October 29, 2024 10:40
Copy link

codecov bot commented Oct 29, 2024

Codecov Report

Attention: Patch coverage is 0% with 55 lines in your changes missing coverage. Please review.

Project coverage is 22.87%. Comparing base (d5a65dc) to head (455fccc).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
cmd/neofs-cli/modules/object/put.go 0.00% 43 Missing ⚠️
cmd/neofs-cli/modules/container/create.go 0.00% 12 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2985      +/-   ##
==========================================
- Coverage   22.89%   22.87%   -0.03%     
==========================================
  Files         785      785              
  Lines       58780    58806      +26     
==========================================
- Hits        13460    13454       -6     
- Misses      44441    44471      +30     
- Partials      879      881       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@End-rey End-rey force-pushed the 1339-undefined-behaviour-on-duplicated-container-attributes-when-using-neofs-cli branch from 25c2b07 to 43450f5 Compare October 29, 2024 12:49
cmd/neofs-cli/modules/container/create.go Outdated Show resolved Hide resolved
@End-rey End-rey force-pushed the 1339-undefined-behaviour-on-duplicated-container-attributes-when-using-neofs-cli branch from 43450f5 to 46ce633 Compare October 29, 2024 14:54
Copy link
Contributor

@cthulhu-rider cthulhu-rider left a comment

Choose a reason for hiding this comment

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

@End-rey resolve conflicts and go

Add a check for the `Timestamp` and the `Name` container attributes, so there
will be an error when you create a container with the `Timestamp` attribute
without the `--disable-timestamp` flag or use the `Name` attribute, which is not
equal to the `--name` flag.
Add a check for the `Timestamp`, the `FileName` and
the `__NEOFS__EXPIRATION_EPOCH` object attributes, so
there will be an error when you put an object with the `Timestamp`
attribute without the `--disable-timestamp` flag, with the `FileName`
attribute without the `--disable-filename` flag or use
the `__NEOFS__EXPIRATION_EPOCH` attribute, which is not equal to the expiration
epoch from '--expire-at' or '--lifetime' flags.
Move logic with expiration epoch attribute to `parseObjectAttrs` function.

Closes #1339.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Check for the key and value of the container attributes for emptiness to prevent
panic in the sdk.
Check for the key and value of the object attributes for emptiness to prevent
error from rpc.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>
@End-rey End-rey force-pushed the 1339-undefined-behaviour-on-duplicated-container-attributes-when-using-neofs-cli branch from 46ce633 to 455fccc Compare October 29, 2024 15:54
@cthulhu-rider cthulhu-rider merged commit ec7e317 into master Oct 29, 2024
19 of 21 checks passed
@cthulhu-rider cthulhu-rider deleted the 1339-undefined-behaviour-on-duplicated-container-attributes-when-using-neofs-cli branch October 29, 2024 16:07
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.

Undefined behaviour on duplicated container attributes when using neofs-cli
4 participants