Skip to content

[Bug] VSC doesn't handle root:root files in root:root directories, when supplied via URIs with (kf6-kio's) admin:// schema. #247910

Closed as not planned
@RokeJulianLockhart

Description

@RokeJulianLockhart

Does this issue occur when all extensions are disabled?

Yes

VS Code Version

Version: 1.99.3
Commit: 17baf841131aa23349f217ca7c570c76ee87b957
Date: 2025-04-15T23:18:46.076Z
Electron: 34.3.2
ElectronBuildId: 11161073
Chromium: 132.0.6834.210
Node.js: 20.18.3
V8: 13.2.152.41-electron.0
OS: Linux x64 6.14.4-300.fc42.x86_64

It's code-1.99.3-1744761644.el8.x86_64:

  1. #!/usr/bin/env sh
    dnf5 --refresh info 'code'
  2. Name            : code
    Epoch           : 0
    Version         : 1.99.3
    Release         : 1744761644.el8
    Architecture    : x86_64
    Installed size  : 400.4 MiB
    Source          : code-1.99.3-1744761644.el8.src.rpm
    From repository : <unknown>
    Vendor          : Microsoft Corporation

OS Version

  1. #!/usr/bin/env pwsh
    #Requires -PSEdition Core
    Get-Content -LiteralPath '/etc/os-release' | Select-String -SimpleMatch 'CPE_NAME'
  2. CPE_NAME="cpe:/o:fedoraproject:fedora:42"

Steps to Reproduce

Type.Screencast.Date.+20250430T230156+0100.webm
  1. Configure the OS & DE to match my kinfo output (which should be the default state of the Fedora Workstation's KDE Spin):

    KDE Plasma Version: 6.3.4
    KDE Frameworks Version: 6.13.0
    Qt Version: 6.9.0
    Kernel Version: 6.14.4-300.fc42.x86_64 (64-bit)
    Graphics Platform: Wayland
  2. #!/usr/bin/env sh
    touch '/home/file.txt' && \
    sudo chown root:root '/home/file.txt'
  3. kwrite

    KWrite understands that the file contains content:

    1. #!/usr/bin/env pwsh
      #Requires -PSEdition Core
      kwrite 'admin:///home/file.txt'
    2. Image

    3. Image

    If authentication fails, it states so:

    1. Image

    2. Image

    "org.freedesktop.DBus.Error.AccessDenied" ""
    "org.freedesktop.DBus.Error.AccessDenied" ""
    kf.kio.workers.file: readData() returned -1
    kf.kio.core: Connection::send() called with connection not invited
    
  4. code

    VSC considers the file to be empty:

    1. #!/usr/bin/env pwsh
      #Requires -PSEdition Core
      code 'admin:///home/file.txt'
    2. Image

    If I attempt to close the file, it prompts me to save it:

    Image

    If I do so, VSC considers the file content to be overwritten:

    Image

    However, it merely reprompts me when I attempt to close the tab again. This behaviour repeats even when I merely supply a path, though. 1

Solution

  1. Always prompt for superuser elevation when necessary.

  2. Throw a (user-comprehensible) exception when an unsupported URI is provided as the location parameter's argument.

Permissions

  1. admin:///home/test.txt

    stat admin:///home/test.txt
      File: admin:///home/test.txt
      Size: 0         	Blocks: 0          IO Block: 4096   regular empty file
    Device: 0,45	Inode: 6819027     Links: 1
    Access: (0644/-rw-r--r--)  Uid: ( 1000/RokeJulianLockhart)   Gid: ( 1000/RokeJulianLockhart)
    Context: unconfined_u:object_r:user_home_t:s0
    Access: 2025-04-30 23:21:04.171264682 +0100
    Modify: 2025-04-30 23:20:56.111128774 +0100
    Change: 2025-04-30 23:20:56.111128774 +0100
     Birth: 2025-04-30 23:20:43.068908859 +0100
  2. /home/test.txt

    stat /home/test.txt
      File: /home/test.txt
      Size: 16        	Blocks: 8          IO Block: 4096   regular file
    Device: 0,45	Inode: 6819414     Links: 1
    Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Context: system_u:object_r:home_root_t:s0
    Access: 2025-04-30 23:35:30.127866527 +0100
    Modify: 2025-04-30 23:23:02.473703946 +0100
    Change: 2025-04-30 23:38:32.925949552 +0100
     Birth: 2025-04-30 23:23:02.473259465 +0100
  3. admin:///home/

    stat admin:///home/
      File: admin:///home/
      Size: 16        	Blocks: 0          IO Block: 4096   directory
    Device: 0,45	Inode: 6819026     Links: 1
    Access: (0755/drwxr-xr-x)  Uid: ( 1000/RokeJulianLockhart)   Gid: ( 1000/RokeJulianLockhart)
    Context: unconfined_u:object_r:user_home_t:s0
    Access: 2025-04-30 23:20:44.166927373 +0100
    Modify: 2025-04-30 23:20:43.068908859 +0100
    Change: 2025-04-30 23:20:43.068908859 +0100
     Birth: 2025-04-30 23:20:43.068908859 +0100
  4. /home/

    stat /home/
      File: /home/
      Size: 78        	Blocks: 0          IO Block: 4096   directory
    Device: 0,45	Inode: 256         Links: 1
    Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
    Context: system_u:object_r:home_root_t:s0
    Access: 2025-04-30 23:38:32.954950041 +0100
    Modify: 2025-04-30 23:38:32.925949552 +0100
    Change: 2025-04-30 23:38:32.925949552 +0100
     Birth: 2025-03-09 14:50:28.432002762 +0000

2

Footnotes

  1. issues/247915#issue-3032730656

  2. askubuntu.com/revisions/528414/1#content

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionalityfile-ioFile I/O

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions