Do more on the web, with a fast and secure browser!

Download Opera browser with:

  • built-in ad blocker
  • battery saver
  • free VPN
Download Opera

scoped_dir folders in downloads directory

  • This is a user forum, though a few of the devs have been known to visit. If you want to report a bug, the place for that is https://bugs.opera.com/wizarddesktop/

  • I have no idea if they vanish on browser close or not as I never close my browser. I have rebooted a few times, and just tested after boot by opening and then closing Opera, so I can confirm they are NOT removed when closing Opera.

    When you rebooted, did you close Opera first? Opera probably doesn't clean them up if it doesn't get to shut down properly. The OS is supposed to notify you/Opera that it's shutting down so that Opera can properly close, but I don't know if that situation works properly in Opera. So, I would make sure you explicitly close Opera yourself before choosing to reboot if you haven't been.

    Also, for folders that aren't deleted when they're supposed to be (because of improper shutdown of Opera for example), I'm assuming those ones will never be automatically deleted by Opera in the future as Opera lost the handles to those folders or something. As in, they got removed from the "to be deleted on closing" list.

    So, what I would do is go to "Downloads" in Opera and clear all your downloads. Then, I would close Opera and manually delete all those scoped directories in your downloads. Then, from now on, make sure Opera is closed properly. If for some reason it isn't, and you downloaded something, immediately check your downloads folder and get rid of any that are left behind so they don't build up.

    With that said, Opera probably needs a better strategy for this. Maybe it should tag the scoped directories it creates with "opera" or something and then always any opera-related scoped directory on close (or maybe even asynchronously on startup).

  • Trouble still present. 😠

  • This thing is really irritating. How on earth can this be so incredibly hard to figure out by devs? It's not like all Windows apps just randomly create "scoped_dir" named folders for the downloads. There is obviously a piece of code in Opera that does this specifically under certain situations entirely unknown to users.

  • As far as I know, those folders are created when you open an executable file from inside Opera and it seems to happen for security reasons.

  • @rejzor said in scoped_dir folders in downloads directory:

    This thing is really irritating. How on earth can this be so incredibly hard to figure out by devs? It's not like all Windows apps just randomly create "scoped_dir" named folders for the downloads. There is obviously a piece of code in Opera that does this specifically under certain situations entirely unknown to users.

    Delete any scoped_dir folders that you currently see. Then, for new ones that Opera creates, are they getting deleted when Opera is properly closed by you? If so, then it appears to be intended behavior. The directories not being created in the temp directory seems to be intended behavior too when the downloads folder isn't on the root drive.

    Not saying things couldn't be improved.

  • @burnout426 WHY!? Why does it matter where folders are located? That's just dumb. Windows has standardized TEMP folders if they need to use. For everything else, if Opera has write rights, just write the damn file in there. Instead making a folder within a folder where it's suppose to actually save the download file makes even less sense. So, they have the rights to create a folder within a designated folder and create a file in there. If you can do that, then why not just write that very file into the "root" folder instead of creating scoped_dir in there?

    And monitoring this is especially stupid. It doesn't seem to create them on every single download, otherwise my Downloads folder would be absolutely filled with them. But yet, they keep on being created there somehow (or being left there).

    I mean, obviously there is a logic/mechanism behind it and a developer could easily know in a second what it is. If anyone ever bothered to even check for this.

  • @rejzor said in scoped_dir folders in downloads directory:

    And monitoring this is especially stupid. It doesn't seem to create them on every single download,

    It's when you download an exe and launch it from within Opera from the download dialog/bar.

    WHY!? Why does it matter where folders are located?

    I would imagine the idea is that if the download directory is somewhere else than on the root drive (like a usb stick or other personal hard drive), it's a privacy issue to create the temp files on the root, so they're created where the download directory is at. It's just a guess though.

  • @burnout426 No other browser does this and yet they all work just fine. How come, eh?

  • @rejzor said in scoped_dir folders in downloads directory:

    @burnout426 No other browser does this and yet they all work just fine. How come, eh?

    I'm having trouble producing the problem in both Opera and Chrome right now, but Chrome was doing this too when I initially tested this problem. If you look up scoped_dir issues, they're usually Chrome/Chromium issues (and Opera uses Chromium).

    But, even if Chrome's not doing it, some Opera devs will have to answer the "How come?". I can just suggest that Opera is usually more conscious of privacy and security. Then again, it could just be a side effect of the way Opera implement the UI.

    I'll keep trying to reproduce the issue again.

  • @burnout426 said in scoped_dir folders in downloads directory:

    I'm having trouble producing the problem in both Opera and Chrome right now, but Chrome was doing this too when I initially tested this problem.

    I was able to reproduce in Opera again (not Chrome though). I forgot the drive had to be NTFS for it to work (I assume it's required for the security measures for the directory).

  • @burnout426 Anyone actually still uses FAT32 these days for things other than USB drives?

  • @rejzor Not sure. It was indeed a usb thumb drive I was testing with.

  • FWIW, I filed bug DNA-65689 with a good description of the problem and good steps to reproduce; to try to get some official answers on the behavior and to fix and improve things. Pointed to this thread also.

  • Okay. The reason for creating the scoped directories is to prevent DLL hijacking when launching executables that don't use safe DLL searching. By launching the executable from within a separate folder, it prevents dangerous DLLs (that you accidentally downloaded or were tricked into downloading) in the downloads directory from being used by the executable instead of the real, safe system versions of the DLLs.

    The exe that's placed in the scoped directory isn't a copy of the exe. It's an NTFS hard link to the original (which you can check with fsutil hardlink list filename), so it's not taking up extra space. By default, the scoped directory is placed in the system %TEMP% directory. However, if you set the download directory to another drive, the scoped directory must be created on that drive instead (in the downloads directory for example) because NTFS hard links can't cross file system boundaries.

    These scoped directories are deleted when Opera properly shuts down.

    So, Opera is doing this to protect the user from this type of attack, and all of Opera's current behavior with the scoped directories is correct / expected.

    However, more-robust handling of cleanup of the directories might be investigated.

    Hope that helps.

  • @burnout426 Fine, but then fix the Opera to clean up this stuff correctly. It's clearly broken if these folders are being left behind.

  • @rejzor said in scoped_dir folders in downloads directory:

    @burnout426 Fine, but then fix the Opera to clean up this stuff correctly. It's clearly broken if these folders are being left behind.

    Can you list each situation where Opera doesn't clean them up? On shutdown of Opera, Opera is at least cleaning up ones it created in that session for me.

  • I stopped executing downloaded programs from within Opera. Not a single scoped_dir folder in there. It's just annoying that I have the popup there inside Opera interface and I have to avoid using it and manually opening the downloads folder when the thing could work right from the get go in cleaning up its mess in the first place. I mean, no other program uses "scoped_dir" so why doesn't Opera try to clean it up on restarts, checking its designated download folder for scoped_dir folders and if there are any, clean them up. If they are in use, it won't allow it anyway so you just can't make the cleanup wrong. It's an easy fix if anyone at least bothered to do it...

  • Agreed with rejzor.
    I always set download directory as "D:\" and I don't want to see strange & ugly folders on my working drive.

  • As a workaround, you could put:

    noscoped.bat

    FOR /D %%X IN (scoped_dir*) DO RD /S /Q "%%X"
    

    in the downloads folder and double-left-click it for easy cleanup.

    Or, you could do something like:

    cd "d:\downloads"
    FOR /D %%X IN (scoped_dir*) DO RD /S /Q "%%X"
    

    for the batch file and then modify Opera's shortcut to be something like:

     "d:\downloads\noscoped.bat" & "C:\Program Files\Opera\launcher.exe"
    

    That bat obviously wouldn't execute if you launched Opera via a file association (unless you edited the commands in the registry). But, it'd work for the normal shortcut case.

    On a side, I did notice that if you close Opera while a scoped directory it created is in use (because the installer is still open in the directory), Opera won't delete it, obviously. So, that's another situation to avoid.

Log in to reply