JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.53k stars 2.47k forks source link

Wrong User for fileDirectoryLatex #9990

Open lcnittl opened 1 year ago

lcnittl commented 1 year ago

JabRef version

5.9 (latest release)

Operating system

Windows

Details on version and operating system

No response

Checked with the latest development build

Steps to reproduce the behaviour

JabRef locks onto the first user encounter in fileDirectoryLatex.

To reproduce:

  1. Create bib file

  2. on a HostA with a UserA set fileDirectoryLatex to C:\Path\A (via GUI Library > Library properties > LaTeX file directory)

    This will create the following comment:

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}

    and shows in the GUI as:

    image

  3. Move/Copy the file to a HostB

  4. on HostB with a UserB set fileDirectoryLatex to C:\Path\B

    Instead of the anticipated comments:

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}
    
    @Comment{jabref-meta: fileDirectoryLatex-UserB-HostB:C:\\Path\\B;}

    the file will now contains:

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}
    
    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostB:C:\\Path\\B;}

    (note the user on HostB is set to UserA)

    Yet, the GUI shows:

    image

  5. Features like relative paths of Aux File (for TexGroup) do not work.

Temporary "fix" in the bib file:

The user can be manually corrected in the bib file (with a text editor):

 @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}

 @Comment{jabref-meta: fileDirectoryLatex-UserB-HostB:C:\\Path\\B;}

Now, the TexGroup relative paths for Aux File works.

Problems encountered with this "fix":

However, the GUI shows an empty LaTeX file directory (Library > Library properties):

image

When adding C:\Path\B on HostB back via GUI, the bib file contains:

 @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}

 @Comment{jabref-meta: fileDirectoryLatex-UserA-HostB:C:\\Path\\B;}

 @Comment{jabref-meta: fileDirectoryLatex-UserB-HostB:C:\\Path\\B;}

(note the additional entry for HostB, again with the wrong user UserA)

The GUI would now show the field filled:

image

Appendix

No response

koppor commented 1 year ago

This refs https://github.com/koppor/jabref/issues/572, because there should be a proper hover.

@lcnittl Can you show me, what on HostB is shown in the preferences as default owner?

grafik

koppor commented 1 year ago

After this is fixed, work should start at https://github.com/JabRef/jabref/issues/8344

lcnittl commented 1 year ago

@koppor Nice hint -- indeed the default owner on HostB was set to UserA (i.e. the OS username on HostA).

Some more testing, always starting from:

@Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}

(where JabRef default owner = OS username = UserA)

Actions performed on HostB: (OS username = UserB)

  1. JabRef default owner = UserA

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}
    
    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostB:C:\\Path\\B;}
  2. JabRef default owner = UserB (= OS username )

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}
    
    @Comment{jabref-meta: fileDirectoryLatex-UserB-HostB:C:\\Path\\B;}

    → this matches the desired config

  3. JabRef default owner = UserOther

    @Comment{jabref-meta: fileDirectoryLatex-UserA-HostA:C:\\Path\\A;}
    
    @Comment{jabref-meta: fileDirectoryLatex-UserOther-HostB:C:\\Path\\B;}

So there seems to be a mix-up between OS username and JabRef default owner:

  1. JabRef stores the "default owner" when writing the bib file, but
  2. the OS username is expected when reading the file
lcnittl commented 1 year ago

Probably related: The fileDirectory property is also affected by this, although it uses "JabRef default owner" for both storing and reading (and completely ignores OS user).