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

Creating or editing a group of cited entries triggers "Library has been modified by another program." whenever saving the library subsequently #6420

Closed
systemoperator opened this issue May 4, 2020 · 10 comments · Fixed by #6586
Labels
bug Confirmed bugs or reports that are very likely to be bugs groups

Comments

@systemoperator
Copy link
Contributor

systemoperator commented May 4, 2020

Tested with the latest JabRef development version (master branch) on Ubuntu 16.04

Steps to reproduce the behavior (creating group):

  1. Save current library (only needed, if the library is indicated as modified)
  2. Create a group of cited entries with an attached *.aux file
    • Side note: even without attaching an existing *.aux file and leaving this field empty allows reproducing it as well
  3. The library has been modified, indicated by the star character (*) in the tab of the main table
  4. Save library

Observation:

After saving the library, the message "Library has been modified by another program." shows up, asking either to choose "Dismiss changes" or "Review changes". When such a group has been created (or updated), then this message appears whenever the library is changed and gets saved.

Steps to reproduce the behavior (editing group):

After restarting JabRef and opening the previously opened library the aforementioned issue does not arise until one does the following (or one repeats the steps above):

  1. Save current library (only needed, if the library is indicated as modified)
  2. Edit an existing group of cited entries
  3. Click "OK" to save the changes in the dialog for editing an existing group of cited entries (no changes need to be made in the dialog)
  4. A dialog appears, asking "Assign the original group's entries to this group?"
    4.1. Either click "Cancel" or "OK" (it does not matter)
  5. The library has been modified, indicated by the star character (*) in the tab of the main table
  6. Save library

Observation:

After saving the library, the same issue as described above arises.

Remark:

As stated in #6394, groups of cited entries also have another issue.

Removal of issue:

  1. Delete the group of cited entries or change the group type to something different than "Cited entries".

Observation:

The issue vanishes.

@tobiasdiez
Copy link
Member

Maybe the color code changes upon saving? (I slightly remember there was something like that in the code...)

@systemoperator
Copy link
Contributor Author

I've tried to find some differences in the variable changes in

but there is quite a lot information contained. I could not find any differences, only things which are equal.

@systemoperator
Copy link
Contributor Author

systemoperator commented May 29, 2020

What I could find is that in "metadata change", the originalMetaData entry had subscribers, but the newMetaData entry doesn't.

@tobiasdiez
Copy link
Member

@ #6420 (comment)
This looks like a bug. The change scanner should only return things that are different...

What you you mean by the "subscribers" for the metadata change? What's the content of

public List<String> getDifferences(JabRefPreferences preferences) {
?

@systemoperator
Copy link
Contributor Author

The content of changes at

looks as follows:

image

The content of changes at

public List<String> getDifferences(JabRefPreferences preferences) {

is:

image

The subscribers I was talking about were at (but probably irrelevant):

image

@systemoperator
Copy link
Contributor Author

systemoperator commented Jun 1, 2020

But I suspect properly fixing #6394 could fix this as well, because everything started with that.

@tobiasdiez
Copy link
Member

Thanks for the investigation. It's strange. I don't see any problems with the equals method of the groups:

AbstractGroup that = (AbstractGroup) other;
return Objects.equals(this.name.getValue(), that.name.getValue()) && Objects.equals(this.description, that.description)
&& Objects.equals(this.context, that.context);

It's also strange that you experience this problem since bc57d22, since this change doesn't touch anything that is relevant for the group diff.

Can you please have a closer look and see which groups fail the equality check (and why).

@systemoperator systemoperator changed the title Editing a group and saving library triggers "Library has been modified by another application." Creating or editing a group of cited entries triggers "Library has been modified by another program." whenever saving the library subsequently Jun 3, 2020
@systemoperator
Copy link
Contributor Author

systemoperator commented Jun 3, 2020

@tobiasdiez I have concretized the description and reproducibility of the issue in its description #6420 (comment). Can you reproduce it this way?

@Siedlerchr Siedlerchr added groups bug Confirmed bugs or reports that are very likely to be bugs labels Jun 3, 2020
@systemoperator
Copy link
Contributor Author

It's also strange that you experience this problem since bc57d22, since this change doesn't touch anything that is relevant for the group diff.

@tobiasdiez You are right about commit bc57d22. It is not the cause of this issue. I have tested this issue before this commit now and it persists. (Sorry for the confusion.)

@systemoperator
Copy link
Contributor Author

systemoperator commented Jun 3, 2020

For the case, where an *.aux is attached and the group gets updated, the diff is caused by the following line:

return Objects.equals(group, that.group) &&

where Objects.equals(group, that.group) is false.

group = 
TexGroup{filePath=/home/systemoperator/test/main.aux, keysUsedInAux=[Test2015, Test2018], auxParser=org.jabref.logic.auxparser.DefaultAuxParser@f972069, fileMonitor=org.jabref.gui.util.DefaultFileUpdateMonitor@1bb768ee} AbstractGroup{name='cited entries', context=INDEPENDENT, color=Optional[0x008000ff], isExpanded=true, description=Optional.empty, iconName=Optional.empty}

that.group = 
TexGroup{filePath=main.aux, keysUsedInAux=null, auxParser=org.jabref.logic.auxparser.DefaultAuxParser@4ded40, fileMonitor=org.jabref.model.util.DummyFileUpdateMonitor@29db0b7c} AbstractGroup{name='cited entries', context=INDEPENDENT, color=Optional[0x008000ff], isExpanded=true, description=Optional.empty, iconName=Optional.empty}

More concretely, it's finally the filePath which causes the problem at:

return Objects.equals(filePath, group.filePath);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Confirmed bugs or reports that are very likely to be bugs groups
Projects
None yet
3 participants