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 "Library has changed externally" with CRLF markers #8239

Merged
merged 4 commits into from
Nov 14, 2021
Merged

Conversation

koppor
Copy link
Member

@koppor koppor commented Nov 14, 2021

Fixes #4877

When a user had CRLF configured as line ending and stored a multiline field (such as comment), JabRef always complained with "the library has been modified externally". See #4877 (comment) for an MWE.

This PR fixes it and also refines the duplicate checker itself.

  • Change in CHANGELOG.md described in a way that is understandable for the average user (if applicable)
  • Tests created for changes (if applicable)
  • Manually tested changed features in running JabRef (always required)
  • Screenshots added in PR description (for UI changes)
  • Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

- Compare remaining fields if requried and optional do not differ
- Ignore CRLF at field comparison
@koppor koppor changed the title Fix 4877 Fix "Library has changed externally" with CRLF markers Nov 14, 2021
@koppor koppor mentioned this pull request Nov 14, 2021
5 tasks
@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Nov 14, 2021
@Siedlerchr Siedlerchr merged commit c94fa48 into main Nov 14, 2021
@Siedlerchr Siedlerchr deleted the fix-4877 branch November 14, 2021 19:28
Siedlerchr added a commit that referenced this pull request Nov 19, 2021
* upstream/main: (181 commits)
  Add of ADRs 22 and 23 (#8256)
  [Bot] Update CSL styles (#8245)
  Replace styfle/cancel-workflow-action@0.9.1 by GitHub's "concurrency" feature (#8243)
  Bump gittools/actions from 0.9.10 to 0.9.11 (#8248)
  Bump commons-cli from 1.4 to 1.5.0 (#8250)
  Bump byte-buddy-parent from 1.12.0 to 1.12.1 (#8249)
  Bump antlr4 from 4.9.2 to 4.9.3 (#8251)
  Bump archunit-junit5-api from 0.21.0 to 0.22.0 (#8252)
  Fix search: NOT binds more than AND (#8241)
  New Crowdin updates (#8240)
  Make PdfGrobiImporterTest as FetcherTest
  Oobranch g : add actions (#7792)
  Fix mixed CRLF / CR (#8238)
  Fix "Library has changed externally" with CRLF markers (#8239)
  Fix for issue 8198, 8133 (#8229)
  Added more unit tests in AuthorTest (#8214)
  Add confirmation dialog for empty entries in JabRef (#8218)
  Fix entry editor column visibility (#8232)
  Use regexp to remove non-ASCII characters from DOI and inform user when data for valid DOI does not exist #8127 (#8228)
  Fix exception for search flags (#8237)
  ...
@wujastyk
Copy link

JabRef 5.4--2021-11-15--6293196
Linux 5.11.0-40-generic amd64
Java 16.0.2
JavaFX 17.0.1+1

Just had this again :-(

  1. Typed in a new article entry (image 1 below)
  2. Immediately got the "library has been modified" message
  3. Clicked "Review Changes" then "Mark All" and got image 2 below, that shows zero visible changes in the title.
  4. Ground my teeth for a while, then moved on. :-)

Image 1

Screenshot from 2021-11-24 15-38-17

Image 2

Screenshot from 2021-11-24 15-38-41

@Siedlerchr
Copy link
Member

I also could reproduce this by copy pasting an abstract. I guess it's related to multiline fields. Will check this. Maybe something has changed there

@Siedlerchr
Copy link
Member

@wujastyk Can you please test the newest version again? We noticed that there was an error in our deployment process and so the new version with the fixes did not upload

@wujastyk
Copy link

I'd wonder about the long gap since the last version 🙂. I'll report again later today.

@wujastyk
Copy link

JabRef 5.4--2021-11-29--217f902
Linux 5.4.0-91-generic amd64
Java 16.0.2
JavaFX 17.0.1+1

There have been fewer cases, but I had another one just now, while adding a new book entry. The entry was uncomplicated. There was a question mark in the title. Could that be it?

@Book{jenk-1999,
  author    = {Keith Jenkins},
  date      = {1999},
  location  = {London and New York},
  publisher = {Routledge},
  title     = {Why History? Ethics and Postmodernity},
}

Here's the screenshot of the first error message:

Screenshot from 2021-11-30 12-52-37

And here's the "review changes" screenshot. There are no visible differences.

Screenshot from 2021-11-30 12-52-56

@koppor
Copy link
Member Author

koppor commented Nov 30, 2021

I reopened the issue and commented there --> #4877 (comment)

Issue reopened. Hoping, I will find some time this year.

@JoKalliauer
Copy link
Contributor

@wujastyk

Do you write the entire entry by keyboard, or did you copy it from bib or from PDF? Copying Text from PDF can imho sometimes lead that you copy some non-standard character (not-visible character, special version of some kind of white-space,...).

Is the message always related to the last attribute? Maybe changes, which follow after the book-entry are related to the last attribute in the book-entry?

Is the error reproducible? (If so, how?)

@wujastyk
Copy link

wujastyk commented Dec 1, 2021

I typed it from the keyboard.

The last attribute idea is a good one. I'll keep an eye out for this in future.

Reproducible, no, which is so annoying.

@wujastyk
Copy link

wujastyk commented Dec 1, 2021

JabRef 5.4--2021-11-28--69467d3
Linux 5.4.0-90-generic amd64
Java 16.0.2
JavaFX 17.0.1+1

Oh, that's interesting. I typed the Jenkins entry (above) by hand, pressed save, and got the "library has been modified" message.

And I've been able to repeat this several times.

  1. Open the bib file (^N),
  2. type the Jenkins entry,
  3. click the save icon.
  4. Get "mod" message.

The mod message does not appear if I type the entry without the question-mark in the title.
But I if I just type the title "Why?" then the mod message also does not appear.

@Siedlerchr
Copy link
Member

@wujastyk Did you use the "New entry " -> Book or did you first insert the "article" and modified the bibtex source?

@wujastyk
Copy link

wujastyk commented Dec 4, 2021

I did the former, "new entry / book".

@wujastyk
Copy link

wujastyk commented Dec 4, 2021

I am again thinking about having JR open on two machines, sharing the db via Dropbox. I'll try some tests later today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

When saving: The libary has been modified by another program
5 participants