Xfce

Subdomains
 

GSOC contribution summary

  • August 17, 2021
  • Yongha Hwang

Secure .desktop handling (Thunar !117, !121, Exo !44, Libxfce4util !16)

.desktop file is a special kind of script that is optimized for launching application. It can use custom icon and name to represent application. However, this feature can be abused as it can disguise it as any type of file. To prevent this security breach, I introduced a “trused” flag to mark whether this .desktop file is safe to execute. By utilizing GVFS-metadata, there is no way that the flag of any downloaded file. A user will be warned about the safety hazard until the user sets “trusted” flag up.

File copy improvements

Implement queued transfer management (Thunar !116)

Sequential transfer, which is introduced in 4.16, caused freuqent freeze and/or crash. Now sequential transfer is handled by a queue, and now this feature works without a problem.

Keep modified time for the file copied from foreign location (Thunar !127)

When copying from remote locations, all the metadata gets lost. The original plan was to use g_file_build_attribute_list_for_copy() to overwrite metadata of the copied file, but for now, it only copies modified time of the original file.

Use “copy name” when copying from gvfs-google backend (Thunar !121)

When copying a file from gvfs-google (google-drive:// protocol), the filename was replaced with unreadable number-alphabet combination. Now the filename is maintained without a problem.

Use intermediate file to copy files (!130)

When a file transfer gets interrupted for any reason, the file that is not fully transferred is left on the destination. Since that the single file on the destination is guaranteed to be corrupted, a user cannot just retry copying the same file on the destination and skip duplicate files. To solve this problem, Thunar will try to delete the incomplete file if it can. In case the destination is not accessible at the time, there is a safer option that first copies a file with a different name than the original and then change the name of the copied file to its original.

Fix invalid filenames when copying to FAT-like filesystem (!137, !138)

FAT and NTFS have a stricter naming rule than EXT filesystem. Also, Windows has a reserved word for filename. For this reason, when copying a file to FAT-like system, Thunar will automatically rename to avoid illegal names before copy.

Check if a target directory is a subdirectory of the moved folder (!139)

Now Thunar will check if a target directory is a subdirectory of the moved folder before trying to copy files.

Implement “safe copy” (!144)

New option “safe copy” will compare checksum of the original and the copy if enabled. This will largely increase copy time, but it would be useful if the source location or the destination is unreliable.

Miscellaneous

For directories, leave size column blank (Thunar !83)

For some reason, Thunar has shown a block size of the filesystem as the “file size” of the directory. This value might be confusing to a user, so now the file size is only shown for regular files.

On “Select by Pattern” add option for case sensitivity (Thunar !89, !98)

“Select by Pattern” feature was not case sensitive, so now case insensitive select is introduced and set as a default.

Improve computer:// panel (Thunar !92)

Detail view for computer:// was incomplete since it cannot be handled like a normal directory. Now “size” column shows disk usage info, and “type” column shows a device type.

Deprecate ExoBinding (Exo !42, ThunarMediaTagsPlugin !4, Xfce4PlacesPlugin !7, Thunar !113, ThunarVolman !8)

Since ExoBinding in Exo can be replaced with GBinding in GLib, ExoBinding is deprecated and the usage within XFCE project is replaced with GBinding.

Preserve metadata when editing desktop item (Exo !43)

When editing a desktop item with exo-desktop-item-edit, all the metadata got lost since the modified file was actually a new file that replaces older one. This problem is fixed and the file modified maintains its info.

Weekly update

  • July 4, 2021
  • Yongha Hwang

Safety flag

Related: Thunar !121

Coding safety flag interface is done, but since it requires new version of libxfce4util, it is waiting for docker image to be updated.

Keep metadata when copying from remote location

Related: Thunar !127

Thunar loses some metadata on copy when file source is from remote location like ftp://. Right now, I am working on what metadata should be copied in that case.

Use proper name to copy files

Related: Thunar !128

gvfs-gdrive extension provides a neat way to use Google Drive as a network drive, but copied files got an unintelligible name for some reason. So I am patching up the logic to move the files into a readable name.

Safe copy

Related: Thunar !130

This MR will add a feature to separate copy-in-progrss files and already copied files in case something aborts the copy, so “skip all existing files” on the second try can guarantee that every file is copied properly. Without this feature, the user has to copy every file again or somehow find which one is a corrupted file (which is like finding a needle in haystack).

It also will provide optional feature to check every file copied that it is not corrupted - probably used for network drives.

Right now only the first part is done - every files copied will be first named as *.partial~ (which is hidden) and be renamed after copy.

Weekly update

  • June 25, 2021
  • Yongha Hwang

Another update!

Safety flag - almost done!

Related : Thunar !121

Interface for safety flag is almost done. A bit more polishing and it would be good to go.

Exo-Desktop-Item-Edit

Keep metadata on edit

Related : xfdesktop #68->Exo #64, Exo !43

exo-desktop-item-edit, which is used to edit .desktop files, removed metadata while writing changes. This caused permission bits to be reset without execution bit. It is now patched to preserve metadata (including safety flag and execution bit).

Support for safety flag

Related : Exo !44

While fixing previous issue, I added an optional feature to support safety flag on exo-desktop-item-edit. Now if libxfce4util supports safety flag, .desktop file will be created with safety flag on.

(A bit late) weekly update

  • June 21, 2021
  • Yongha Hwang

Well, it’s a bit late for a weekly update that it should be rather called decadly update. But well, better than nothing!

WIP: Safety flag

Related:

I’m still working on safety-flag, which is mentioned in my introduction post and 2nd saturday post. Not much have changed, but now an interface for safety flag is going to be merged into libxfce4util. Also, this flag will now only be used for .desktop files, rather than every executables.

Also, the UI part of this project also got its MR page (Thunar !121). Several discussion later (startig from here), we decided to put checkbox for safety flag on Property->Launcher. Because flicking trusted flag on should also trigger executable flag on, it would be preferrable to show it visually. Thus toggle button for executable flag would also be on Launcher tab. So this would be how it will look like:

image_for_new_UI

Additional update

Related: libxfce4ui !42 (42 is a nice number!)

While I was working on safety flag, I got distracted by the boilerplates used on several XFCE projects, which was a direct copy of thunar_gtk_label_set_a11y_relation(). To use this function across XFCE projects, I ported this to libxfce4ui as xfce_gtk_label_set_a11y_relation(). Doesn’t it feel good when duplicate codes are replaced with a proper function?

Weekly update – transfer queueing, execution safety flag, and MTP

  • June 12, 2021
  • Yongha Hwang

Transfer queueing

Thunar !569

After transfer queueing was introduced, it frequently caused crashes or freezing when working with remote location. This problem was solved by introducing a waiting queue. To be released in Thunar 4.17.4.

  • This patch will not be backported. If you have this problem with Thunar 4.16, it is recommended to set parallel transfer to “Always” to avoid this problem.

  • You might ask about how it was done before. How can a job can be queued when there is no queue? The answer is simple. Since every transfer job runs on a separate thread, it is possible to play a game of musical chairs. Every thread tries to be the only active thread, and if a thread fails to start, it waits until the next opportunity arises. This is easy to implement when parallel transfer is already implemented. But unfortunately, the game did not go well.

WIP: Introduction of an execution safety flag

(I recommend reading Thunar !156 for the context.)

Since the executable bit is not enough to confirm that the file is safe to execute, I am implementing an additional metadata (execution safety flag). Thunar will check this flag even if the execution bit is on, so a user has to confirm that they know that they are launching an executable. This data is contained in GVFS-metadata, and will remember SHA-256 hash value of that file. This will work as a per-file option to allow launching the executable.

I already finished coding a feature to save a hash value per-file and using it to verify executable, and will be added to libxfce4util soon. Interface with this safety flag is still work-in-progress, though.

WIP: MTP freeze

Thunar:async-icon-render

Recently, there are a lot of issue reports about MTP, and most of the complaints are about freeze. A directory under mtp:// that contains a lot of files tends to cause problems. One problem is that icon renderer reads file contents and might clog the main event loop, so I am experimenting with icon rendering right now. Trying to change directory while a directory is loading also freezes the environment, so requesting a file list of the current directory (or cancelling it) might be blocking for some reason.

GSOC 2021

  • June 2, 2021
  • Yongha Hwang

Good news! I have been accepted to GSoC 2021. (Well, actually, it had been 3 weeks since it was announced, so I “was” accepted, to be exact.) I am contributing to XFCE this summer, so I will explain who I am, and what I am going to do.

First stop. So, who am I? My name is Yongha Hwang, and I am an Electronic Engineering sophomore. And that’s enough for personal information to do about contributing, so I’ll explain my experience with Linux, XFCE and C altogether.

I use Linux as my main OS. For developemnt, for surfing web, for entertainment like gaming, and everything else that happens after pressing power button. Although I use it as a main OS, I reinstall linux every 3~6 months. Since I don’t install the same thing everytime, I have used Ubuntu, Xubuntu, Linux Mint (both Cinnamon and MATE), Manjaro, Arch, Gentoo, and et cetra. I have even used Linux from Scratch (with LXQt) as a main OS.

My first experience with XFCE was Xubuntu in 2011. My first linux distribution was Ubuntu, as you have guessed. At that time Ubuntu was packed with Unity DE. It looked very futuristic to me since the only UI experience was with Windows XP and 98. But it did have one big problem to me: it was resource-heavy. The computer I was using at that time was quite slow and Internet Explorer took a whopping 12 seconds to show up. So I had to look for a lighter alternative and Xubuntu was a natural choice. Since then I liked how light DEs look like, so I use light DEs most of the time not because of my low-end PC, but because I like the visual of “nothing fancy but looks fine enough.”

I started programming in C about the time I started using Linux. I have not much to tell about C, though. What I do have to show is a Scheme interpreter, which I made when I was studying SICP (for fun, and I think it’s worth the time.)

So, what do I work on for XFCE? I have set two big goals for this summer.

Fix buggy launch behavior

Some people experience a bug that thunar tries to execute ordinary files like subtitles, and even directories. That happens when these files have execution bit (+x) enabled. I will try to fix this problem by checking MIME type before executing.

Another problem with launch behavior is that someone can slip in an executable file with execution bit on by packing it inside tar archives. This may not be a problem with normal scripts, but .desktop files can change their icon or file name to resemble normal document files. Files (formerly known as Nautilus,the file manager of GNOME) had the same problem before and they introduced safety flags using GVFS metadata as a solution. We can do the same trick because we use GVFS, too.

Improvements to file transmission

Have you ever experienced this: You were copying a lot of files, and somehow it got interrupted. You copy same files again. You skipped everything that was “already copied” to save time, only to find out a year later that the most important file was interrupted during the copy and you are left with the first 10KB of that file. To prevent this issue, you can copy every files again just to be sure, but that is a huge waste of time. If there is an option that leaves a partailly copied file as *.partial and it automatically deletes one, wouldn’t it be a better solution? If I have spare time I also would implement pedantic feature like “verify checksum of every files copied” to use on network drives.

Speaking of network files, Thunar loses metadata when copying files from GVFS. GVFS is a wrapper (naively speaking) for exotic locations like network file shares, smartphones, trash bin, and et cetra. Also, files copied from GDrive are labeled with unreadable names rather than the actual file name. I would also fix this problem.


Well, that’s what as far as I can tell! Congratulations to fellow XFCE GSoC contributors Vishal Sharma and Kefalidis Sergios, and major thanks to my mentor Alexander Schwinn.

Check out my Thunar contributions here: