Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8278549: UNIX sun/font coding misses SUSE distro detection on recent …
…distro SUSE 15

Reviewed-by: mdoerr, lucy
  • Loading branch information
MBaesken committed Jan 14, 2022
1 parent 965c64b commit 84976b4
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
18 changes: 17 additions & 1 deletion src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -295,6 +295,12 @@ private String getVersionString(File f) {
return null;
}

private String extractOsInfo(String s) {
if (s.startsWith("\"")) s = s.substring(1);
if (s.endsWith("\"")) s = s.substring(0, s.length()-1);
return s;
}

/**
* Sets the OS name and version from environment information.
*/
Expand Down Expand Up @@ -331,6 +337,16 @@ protected void setOsNameAndVersion() {
} else if ((f = new File("/etc/fedora-release")).canRead()) {
osName = "Fedora";
osVersion = getVersionString(f);
} else if ((f = new File("/etc/os-release")).canRead()) {
Properties props = new Properties();
try (FileInputStream fis = new FileInputStream(f)) {
props.load(fis);
}
osName = props.getProperty("NAME");
osVersion = props.getProperty("VERSION_ID");
osName = extractOsInfo(osName);
if (osName.equals("SLES")) osName = "SuSE";
osVersion = extractOsInfo(osVersion);
}
} catch (Exception e) {
if (FontUtilities.debugFonts()) {
Expand Down
18 changes: 17 additions & 1 deletion src/java.desktop/unix/classes/sun/font/MFontConfiguration.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -114,6 +114,16 @@ protected void setOsNameAndVersion(){
}
osName = props.getProperty("DISTRIB_ID");
osVersion = props.getProperty("DISTRIB_RELEASE");
} else if ((f = new File("/etc/os-release")).canRead()) {
Properties props = new Properties();
try (FileInputStream fis = new FileInputStream(f)) {
props.load(fis);
}
osName = props.getProperty("NAME");
osVersion = props.getProperty("VERSION_ID");
osName = extractOsInfo(osName);
if (osName.equals("SLES")) osName = "SuSE";
osVersion = extractOsInfo(osVersion);
}
} catch (Exception e) {
}
Expand All @@ -134,6 +144,12 @@ private String getVersionString(File f){
return null;
}

private String extractOsInfo(String s) {
if (s.startsWith("\"")) s = s.substring(1);
if (s.endsWith("\"")) s = s.substring(0, s.length()-1);
return s;
}

private static final String fontsDirPrefix = "$JRE_LIB_FONTS";

protected String mapFileName(String fileName) {
Expand Down

5 comments on commit 84976b4

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 84976b4 Mar 23, 2022

Choose a reason for hiding this comment

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

@MBaesken Could not automatically backport 84976b45 to openjdk/jdk17u-dev due to conflicts in the following files:

  • src/java.desktop/unix/classes/sun/font/FcFontConfiguration.java
  • src/java.desktop/unix/classes/sun/font/MFontConfiguration.java

To manually resolve these conflicts run the following commands in your personal fork of openjdk/jdk17u-dev:

$ git checkout -b MBaesken-backport-84976b45
$ git fetch --no-tags https://git.openjdk.java.net/jdk 84976b45315feb6c37a9f3db6e1e62812c9b0a37
$ git cherry-pick --no-commit 84976b45315feb6c37a9f3db6e1e62812c9b0a37
$ # Resolve conflicts
$ git add files/with/resolved/conflicts
$ git commit -m 'Backport 84976b45315feb6c37a9f3db6e1e62812c9b0a37'

Once you have resolved the conflicts as explained above continue with creating a pull request towards the openjdk/jdk17u-dev with the title Backport 84976b45315feb6c37a9f3db6e1e62812c9b0a37.

@MBaesken
Copy link
Member Author

Choose a reason for hiding this comment

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

/backport jdk18u

@openjdk
Copy link

@openjdk openjdk bot commented on 84976b4 Mar 24, 2022

Choose a reason for hiding this comment

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

@MBaesken the backport was successfully created on the branch MBaesken-backport-84976b45 in my personal fork of openjdk/jdk18u. To create a pull request with this backport targeting openjdk/jdk18u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit 84976b45 from the openjdk/jdk repository.

The commit being backported was authored by Matthias Baesken on 14 Jan 2022 and was reviewed by Martin Doerr and Lutz Schmidt.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk18u:

$ git fetch https://github.com/openjdk-bots/jdk18u MBaesken-backport-84976b45:MBaesken-backport-84976b45
$ git checkout MBaesken-backport-84976b45
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk18u MBaesken-backport-84976b45

Please sign in to comment.