Skip to content

libproxy: 0.4.18 -> 0.5.3#272353

Merged
SuperSandro2000 merged 1 commit intoNixOS:stagingfrom
SuperSandro2000:libproxy
Apr 11, 2024
Merged

libproxy: 0.4.18 -> 0.5.3#272353
SuperSandro2000 merged 1 commit intoNixOS:stagingfrom
SuperSandro2000:libproxy

Conversation

@SuperSandro2000
Copy link
Member

@SuperSandro2000 SuperSandro2000 commented Dec 5, 2023

Description of changes

Closes #241762

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@ofborg ofborg bot added 10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Dec 6, 2023
Copy link
Member

Choose a reason for hiding this comment

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

If this still looks for GNOME settings, either a wrapper or patch (see makeHardcodeGsettingsPatch) will still be necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

pxgsettings no longer exists.

Copy link
Member Author

Choose a reason for hiding this comment

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

😒 libproxy/libproxy@3e06882

The new location seems to be https://github.com/libproxy/libproxy/tree/main/src/backend/plugins/config-gnome .

No idea if we need to wrap the proxy binary instead.

Copy link
Member

Choose a reason for hiding this comment

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

proxy program is just a test tool so wrapping it will not help. Looks like the backends are all compiled into libpxbackend.

The only option is patching it as in #271037

Copy link
Member Author

Choose a reason for hiding this comment

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

So, do we now wait for that PR or just hope people wrap?

Copy link
Member

Choose a reason for hiding this comment

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

That PR only affects GTK. I meant is as an example what would have to be done here if we do not want even more wrappers everywhere.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have no experience with C/C++, so that would need to be done by someone else.

Copy link
Member

Choose a reason for hiding this comment

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

I have pushed a patch + update script to update it (depends on #276828). The patch is suboptimal for now (the source is created multiple times) but at least it can be generated automatically.

@SuperSandro2000
Copy link
Member Author

Just rebased the PR. I am not sure what needs to be done to merge this.

@ofborg ofborg bot added 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. and removed 10.rebuild-linux: 501-1000 This PR causes many rebuilds on Linux and should normally target the staging branches. labels Jan 14, 2024
@jtojnar
Copy link
Member

jtojnar commented Jan 20, 2024

We should probably check that it still works.

Also it needs to target staging.

@SuperSandro2000 SuperSandro2000 changed the base branch from master to staging January 24, 2024 13:35
@SuperSandro2000
Copy link
Member Author

We should probably check that it still works.

I am not using gnome :/

but targeted staging

@jtojnar
Copy link
Member

jtojnar commented Jan 24, 2024

I tried the following test case, which revealed the patch was insufficient (there was schema presence check which was not handled) so I pushed a fix.

Unfortunately, it still returns direct:// no matter what I tried.

let
  pkgs = import ./. { };

  testSrc = pkgs.writeText "test.py" ''
    import gi
    gi.require_version('Libproxy', '1.0')
    from gi.repository import Libproxy

    url = 'https://github.com/libproxy/libproxy'

    pf = Libproxy.ProxyFactory()
    proxies = pf.get_proxies(url)
    print(proxies)
  '';
in
pkgs.runCommand
  "libproxy-test"
  {
    nativeBuildInputs = [
      pkgs.glib
      pkgs.gobject-introspection # For setup hook
    ];

    buildInputs = [
      (pkgs.python3.withPackages (pp: [
        pp.pygobject3
      ]))
      pkgs.libproxy
    ];
  }
  ''
    export HOME=$(mktemp -d)
    export XDG_CURRENT_DESKTOP=GNOME
    python3 "${testSrc}"
    (
      export XDG_DATA_DIRS=${pkgs.glib.getSchemaDataDirPath pkgs.gsettings-desktop-schemas}
      gsettings set org.gnome.system.proxy mode manual
      gsettings set org.gnome.system.proxy.http host localhost
      gsettings set org.gnome.system.proxy.https host localhost
      gsettings set org.gnome.system.proxy.https port 8080

      # was it set correctly?
      gsettings get org.gnome.system.proxy mode
      gsettings get org.gnome.system.proxy.http host
      gsettings get org.gnome.system.proxy.http port
      gsettings get org.gnome.system.proxy.https host
      gsettings get org.gnome.system.proxy.https port
    )

    # was it written?
    cat ~/.config/glib-2.0/settings/keyfile

    GSETTINGS_BACKEND=keyfile python3 "${testSrc}"

    # touch "$out"
  ''

@jtojnar
Copy link
Member

jtojnar commented Jan 27, 2024

Looks like my test is failing just because there is no network connection in the sandbox. If I run the updated test case on my live system, it detects proxy correctly:

$ gsettings set org.gnome.system.proxy mode manual
$ gsettings set org.gnome.system.proxy.http host localhost
$ gsettings set org.gnome.system.proxy.https host localhost
$ gsettings set org.gnome.system.proxy.https port 8080
$ PX_DEBUG=1 result/test
(process:137180): pxbackend-DEBUG: 16:03:16.330: px_config_sysconfig_set_config_file: Could not read file /etc/sysconfig/proxy
(process:137180): pxbackend-DEBUG: 16:03:16.330: Active config plugins:
(process:137180): pxbackend-DEBUG: 16:03:16.330:  - config-env
(process:137180): pxbackend-DEBUG: 16:03:16.330:  - config-kde
(process:137180): pxbackend-DEBUG: 16:03:16.330:  - config-gnome
(process:137180): pxbackend-DEBUG: 16:03:16.330:  - config-sysconfig
(process:137180): pxbackend-DEBUG: 16:03:16.334: px_manager_on_network_changed: Network connection changed, clearing pac data
(process:137180): pxbackend-DEBUG: 16:03:16.334: px_manager_constructed: Up and running
(process:137180): pxbackend-DEBUG: 16:03:16.334: px_manager_get_proxies_sync: url=https://github.com/libproxy/libproxy online=1
(process:137180): pxbackend-DEBUG: 16:03:16.334: px_manager_get_proxies_sync: Config[0] = http://localhost:8080
(process:137180): pxbackend-DEBUG: 16:03:16.334: px_manager_get_proxies_sync: Proxy[0] = http://localhost:8080
['http://localhost:8080']
(process:137180): pxbackend-DEBUG: 16:03:16.336: px_config_sysconfig_set_config_file: Could not read file /etc/sysconfig/proxy
(process:137180): pxbackend-DEBUG: 16:03:16.336: Active config plugins:
(process:137180): pxbackend-DEBUG: 16:03:16.336:  - config-env
(process:137180): pxbackend-DEBUG: 16:03:16.336:  - config-kde
(process:137180): pxbackend-DEBUG: 16:03:16.336:  - config-gnome
(process:137180): pxbackend-DEBUG: 16:03:16.336:  - config-sysconfig
(process:137180): pxbackend-DEBUG: 16:03:16.338: px_manager_on_network_changed: Network connection changed, clearing pac data
(process:137180): pxbackend-DEBUG: 16:03:16.338: px_manager_constructed: Up and running

And if I disconnect from network, it will fail on my live system the same way as the sandbox:

$ PX_DEBUG=1 result/test
(process:136949): pxbackend-DEBUG: 16:03:01.921: px_config_sysconfig_set_config_file: Could not read file /etc/sysconfig/proxy
(process:136949): pxbackend-DEBUG: 16:03:01.921: Active config plugins:
(process:136949): pxbackend-DEBUG: 16:03:01.921:  - config-env
(process:136949): pxbackend-DEBUG: 16:03:01.921:  - config-kde
(process:136949): pxbackend-DEBUG: 16:03:01.921:  - config-gnome
(process:136949): pxbackend-DEBUG: 16:03:01.921:  - config-sysconfig
(process:136949): pxbackend-DEBUG: 16:03:01.924: px_manager_on_network_changed: Network connection changed, clearing pac data
(process:136949): pxbackend-DEBUG: 16:03:01.924: px_manager_constructed: Up and running
(process:136949): pxbackend-DEBUG: 16:03:01.924: px_manager_get_proxies_sync: url=https://github.com/libproxy/libproxy online=0
['direct://']
(process:136949): pxbackend-DEBUG: 16:03:01.926: px_config_sysconfig_set_config_file: Could not read file /etc/sysconfig/proxy
(process:136949): pxbackend-DEBUG: 16:03:01.926: Active config plugins:
(process:136949): pxbackend-DEBUG: 16:03:01.926:  - config-env
(process:136949): pxbackend-DEBUG: 16:03:01.926:  - config-kde
(process:136949): pxbackend-DEBUG: 16:03:01.926:  - config-gnome
(process:136949): pxbackend-DEBUG: 16:03:01.926:  - config-sysconfig
(process:136949): pxbackend-DEBUG: 16:03:01.927: px_manager_on_network_changed: Network connection changed, clearing pac data
(process:136949): pxbackend-DEBUG: 16:03:01.927: px_manager_constructed: Up and running
Updated test case
let
  pkgs = import <nixpkgs> { };

  testSrc = pkgs.writeText "test.py" ''
    #!/usr/bin/env python3
    import gi
    gi.require_version('Libproxy', '1.0')
    from gi.repository import Libproxy

    url = 'https://github.com/libproxy/libproxy'

    pf = Libproxy.ProxyFactory()
    proxies = pf.get_proxies(url)
    print(proxies)
  '';
in
pkgs.runCommand
  "libproxy-test"
  {
    nativeBuildInputs = [
      pkgs.glib
      pkgs.makeWrapper
      pkgs.gobject-introspection # For setup hook
    ];

    buildInputs = [
      (pkgs.python3.withPackages (pp: [
        pp.pygobject3
      ]))
      pkgs.libproxy
    ];
  }
  ''
    export HOME=$(mktemp -d)
    export GSETTINGS_BACKEND=keyfile
    export PX_DEBUG=1
    export XDG_CURRENT_DESKTOP=GNOME
    python3 "${testSrc}"
    (
      export XDG_DATA_DIRS=${pkgs.glib.getSchemaDataDirPath pkgs.gsettings-desktop-schemas}
      gsettings set org.gnome.system.proxy mode manual
      gsettings set org.gnome.system.proxy.http host localhost
      gsettings set org.gnome.system.proxy.https host localhost
      gsettings set org.gnome.system.proxy.https port 8080

      # was it set correctly?
      gsettings get org.gnome.system.proxy mode
      gsettings get org.gnome.system.proxy.http host
      gsettings get org.gnome.system.proxy.http port
      gsettings get org.gnome.system.proxy.https host
      gsettings get org.gnome.system.proxy.https port
    )

    # was it written?
    cat ~/.config/glib-2.0/settings/keyfile

    # python3 "${testSrc}"

    mkdir -p "$out"
    cp "${testSrc}" "$out/test"
    chmod +x "$out/test"
    patchShebangs --host "$out/test"
    wrapProgram "$out/test" --prefix "GI_TYPELIB_PATH" ":" "${pkgs.libproxy}/lib/girepository-1.0"
  ''

And reset the settings with:

gsettings reset org.gnome.system.proxy mode
gsettings reset org.gnome.system.proxy.http host
gsettings reset org.gnome.system.proxy.https host
gsettings reset org.gnome.system.proxy.https port

@jtojnar
Copy link
Member

jtojnar commented Jan 27, 2024

I have rebased and enabled tests. I think it is now good to merge.

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Mar 20, 2024
@jtojnar
Copy link
Member

jtojnar commented Apr 11, 2024

@SuperSandro2000 do you agree this would be good to have in 24.05?

@SuperSandro2000
Copy link
Member Author

Now or never 👍🏼

@jtojnar jtojnar added this to the 24.05 milestone Apr 11, 2024
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 11, 2024
@SuperSandro2000 SuperSandro2000 merged commit 57e4ea0 into NixOS:staging Apr 11, 2024
@SuperSandro2000 SuperSandro2000 deleted the libproxy branch April 11, 2024 13:14
@vcunat
Copy link
Member

vcunat commented Apr 14, 2024

@jtojnar
Copy link
Member

jtojnar commented Apr 14, 2024

Hopefully resolved in 107ae55.

@vcunat
Copy link
Member

vcunat commented Apr 15, 2024

Confirmed ❤️

@vcunat
Copy link
Member

vcunat commented Apr 15, 2024

There's include dependency on glib, apparently: https://hydra.nixos.org/build/256292509/nixlog/1/tail

I wonder if it would be best (for the long term) to ensure that they're met, either by propagatedBuildInputs or additional flags in libproxy-1.0.pc.

@vcunat
Copy link
Member

vcunat commented Apr 15, 2024

Wait... that derivation does have glib in build inputs (and it's even shown as detected in the log). I don't get how that include error happens; I don't expect it's really related to libproxy.

EDIT: pushed a workaround at least: c5910ff

@jtojnar
Copy link
Member

jtojnar commented Apr 15, 2024

Looks like this is another issue caused by us interpreting Requires.private differently. We should probably revert libproxy/libproxy#239

@vcunat
Copy link
Member

vcunat commented Apr 15, 2024

Right, pushed as 3a48b90

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

10.rebuild-darwin: 101-500 This PR causes between 101 and 500 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants