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 langAltValue::read() parsing #1482

Merged

Conversation

postscript-dev
Copy link
Collaborator

@postscript-dev postscript-dev commented Mar 6, 2021

The changes are in response to #1481

  • Fix segmentation faults
  • Fix mismatched quotation marks and incorrect values
  • Add tests to unitTest
  • Add text to man page to clarify langAlt tag format

Closes #1481.

+ Fix segmentation faults in langAlt parse
+ Fix mismatched quotation marks and incorrect values
+ Add Python testing
  + Some tests commented out as quotation marks are filtered, preventing them
    from running.
Closes Exiv2#1481.
@clanmills
Copy link
Collaborator

Thanks for doing this work @postscript-dev This will be reviewed next week. I hope it will ship in v0.27.4 RC1 which is on track to ship as scheduled for 2021-03-31.

@clanmills clanmills added this to the v0.27.4 milestone Mar 6, 2021
@clanmills clanmills self-requested a review March 6, 2021 21:25
Copy link
Collaborator

@piponazo piponazo left a comment

Choose a reason for hiding this comment

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

In general the changes look good 👍 . I just made some minor comments


url = "https://github.com/Exiv2/exiv2/issues/1481"

# Python unittest is filtering out empty pairs of "" and flags up an error if
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be possible to test the method LangAltValue::read() in unit tests instead of the python tests? Maybe there you have more control to use different combinations of quotes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I will look into this today.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Your suggestion was helpful. I have added code to the unitTests and removed the Python version.

src/value.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@clanmills clanmills left a comment

Choose a reason for hiding this comment

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

This is good work. Thank You for undertaking this task and adding to the test suite and to the kerErrorCodes.

I'm willing to approve this as it stands (when you fix the spelling of ALPLHA).

Several discussion points:

  1. I agree with @piponazo. We usually test this kind of code in then unitTests.
  2. Should anything be added to the man page man/man1/exiv2.1 about this?
  3. Why is there a lot of stuff commented off in the python code? Should there be a var bFull = False # True in the script prolog to drive in different modes. Why not execute every test?
  4. Is there a reason for the ALPLHA code instead of std::is alpha?
  5. Can any python strings which include " be coded as 'I am a dog " ear'. All those dog ears (my name for a quotation mark character) are tough on the eye.

This is Good Work, so please don't take my comments as criticism.

Removed previous Python tests.
@postscript-dev
Copy link
Collaborator Author

I am working throught the comments that have been provided and will post when I have finished.

Removed unneeded comments and empty space.
@clanmills clanmills mentioned this pull request Mar 9, 2021
Copy link
Collaborator

@clanmills clanmills left a comment

Choose a reason for hiding this comment

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

I will look at this carefully after dinner. At a glance it looks good. Thanks.

I would like to acknowledge you in the release notes. First name is sufficient: #1018 (comment)

@postscript-dev
Copy link
Collaborator Author

postscript-dev commented Mar 9, 2021

@clanmills,

  1. I agree with @piponazo. We usually test this kind of code in then unitTests.

I have made the change.

  1. Should anything be added to the man page man/man1/exiv2.1 about this?

You are right. As I wasn't changing the format, I didn't think of updating the manual page. I've made the change.

  1. Why is there a lot of stuff commented off in the python code? Should there be a var bFull = False # True in
    the script prolog to drive in different modes. Why not execute every test?

I put the tests in that I couldn't get to work in case someone else had a suggestion. Switching them on/off with a flag is a better idea.

  1. Is there a reason for the ALPLHA code instead of std::is alpha?

Originally I thought that as ALPHA_NUM was also needed, that doing the same thing in two different ways might be confusing. Sticking to std:: code is better though. After looking at std::isalpha on cppreference.com , I was wondering if the change in locale might effect the outcome. RFC3066 only allows A-Z and a-z. The locale might introduce other letters?

  1. Can any python strings which include " be coded as 'I am a dog " ear'. All those dog ears (my name for a
    quotation mark character) are tough on the eye.

I didn't see your message until later last night. By that time, I had already moved over to unitTest as Luis suggested. I didn't try the single quotes but will try to use them in the future.

@postscript-dev
Copy link
Collaborator Author

I would like to acknowledge you in the release notes. First name is sufficient: #1018 (comment)

My first name is Peter.

Copy link
Collaborator

@clanmills clanmills left a comment

Choose a reason for hiding this comment

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

@postscript-dev Peter: This is very good work. I see you've thrown away the python code and add the unit test code. Sometimes doing more is the right thing to do.

Yes, you're right about the order and locale. What a can of worms. If anybody ever reports an issue with that, it's likely that they come from a non-ascii locale and will be familiar with such issues and their remedy.

So, I'm going to approve this. When the CI is green, I'll merge. I have already updated the release notes to acknowledge your contribution.

@clanmills clanmills merged commit 822eb1a into Exiv2:0.27-maintenance Mar 9, 2021
@postscript-dev postscript-dev deleted the fix_langAlt_read_func branch October 20, 2021 14:35
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.

Problems processing incorrect LangAlt values
3 participants