Replies: 32 comments
-
How do you have extended attributes setup on the netatalk side? Is it set |
Beta Was this translation helpful? Give feedback.
-
...but if that's supposed to collapse EDIT: ...on the other hand, I remember the manpage saying all it's supposed to do is append a null byte to each xattr for compatibility with Samba's implementation. |
Beta Was this translation helpful? Give feedback.
-
...and as a reminder, this isn't a feature request to make OSX AFP and OSX SMB share the same icons. It's a feature request to make Netatalk reproduce mac filenames less faithfully for better compatibility with the |
Beta Was this translation helpful? Give feedback.
-
OK, I found an answer on that front. The thing I need to stay far away from if I want to ensure I can have separate custom folder icons for AFP and SMB is Still, even if I wanted |
Beta Was this translation helpful? Give feedback.
-
OK, I think I know what is happening. Somewhere Netatalk is converting a literal |
Beta Was this translation helpful? Give feedback.
-
No, it's writing a literal If it were writing the string |
Beta Was this translation helpful? Give feedback.
-
The problem is that the modern way to hide non-dotfiles in file managers on XDG desktops (i.e. Linux, *BSD) is a newline delimited list and "universal" newline splitting algorithms interpret the trailing carriage return as a delimiter instead of part of the filename. Think trying to represent a filename containing a comma in a variant of CSV that doesn't support quoting or escaping. If it were literally any byte other than Depending on how such a splitting algorithm is implemented, it may even only take issue with terminal carriage returns. (eg. I've seen ones where "universal" just means "DOS or UNIX" and they just implemented something like |
Beta Was this translation helpful? Give feedback.
-
MacOS X natively stores the icon files on HFS+ drives using |
Beta Was this translation helpful? Give feedback.
-
Nothing is writing an The feature request is for support for translating Trailing carriage return bytes are literally unrepresentable in a "Newline-delimited list, using DOS or UNIX line endings" file unless the parser is smart enough to follow Vim's stateful approach where only the first line's delimiter is heuristically detected and all following lines are assumed to use the same delimiter type. |
Beta Was this translation helpful? Give feedback.
-
...and yes, I checked. Dolphin's parser is both universal enough to recognize classic mac-style CR-only line endings and stateless enough to allow you to mix different kinds in the same file, so it'll parse this
...like this:
|
Beta Was this translation helpful? Give feedback.
-
OK, so you are manually created/named a file named Netatalk 2.x used to support encoding illegal characters using CAP encoding ( |
Beta Was this translation helpful? Give feedback.
-
I'm manually creating a file named Finder stores custom folder icons inside the resource fork of an invisible file named This feels like I'm being faulted for "allowing" Windows Explorer to splash EDIT: The difference is, I can add a line containing |
Beta Was this translation helpful? Give feedback.
-
To make it clear, Netatalk is faithfully reproducing the filename used by Finder's behind-the-scenes mechanism for custom folder icons... and that's the problem. What I'm asking for is a solution that involves patching Netatalk once instead of tracking down and writing a PR for every single Linux file manager that implements support for the the That latter approach would be about as viable as getting every Linux and BSD file manager in existence to add support for parsing the HFS Invisible flag out of EDIT: And why did Apple use that name to begin with? It's as if Microsoft chose to name |
Beta Was this translation helpful? Give feedback.
-
Just a shot in the dark, the wildcard |
Beta Was this translation helpful? Give feedback.
-
( |
Beta Was this translation helpful? Give feedback.
-
...and, as I suspected for something that doesn't have a clearly defined spec (
I can't think of any other general-purpose file-view implementations that I have installed. (eg. Geeqie only lists directories and files with known-supported image extensions and wxWidgets just delegates to GTK.) In summary, for any folder where someone uses Finder to set a custom icon, so long as Netatalk doesn't support translating the
Basically, as-is, the only way for Macintosh-over-Netatalk and Linux/BSD users to coexist comfortably on the same Linux/BSD filesystem is to either forbid the Macintosh users from setting custom icons (eg. via an Other non-dotfile entries like |
Beta Was this translation helpful? Give feedback.
-
The behavior of using CAP style encoding (storing the filename as EDIT: Scratch that. Netatalk 3.x doesn't support CAP encoding of filenames anymore as it was removed with this commit: f03f4b3 |
Beta Was this translation helpful? Give feedback.
-
Bear in mind that Samba interop is already broken by default because Samba will do its own analogue to CAP style encoding by default. (Users must opt into preferrring interop with Netatalk at the cost of breaking interop with Linux GUI file managers by adding |
Beta Was this translation helpful? Give feedback.
-
To be fair, |
Beta Was this translation helpful? Give feedback.
-
Did the "Samba remaps characters like ...because FAT, exFAT, the Win32 personality of NTFS, and DOS, Win16, and Win32 APIs were forbidding all characters in the |
Beta Was this translation helpful? Give feedback.
-
I don't know for sure as I haven't followed Samba development. Those characters were likely prohibited at the SMB protocol level and Apple did filename mangling on the client side when working with shares that do not support the extensions. FWIW, Windows 11 doesn't seem to care. MacOS seemingly writes the Icon files as |
Beta Was this translation helpful? Give feedback.
-
So why is it Samba's responsibility to go out of its way to to provide a non-default (Even if, personally, I'd prefer the option to translate it differently so I can keep that accidental "different icons for AFP and SMB" feature while also having working ...I suppose I could try spending an afternoon writing an |
Beta Was this translation helpful? Give feedback.
-
At one point, Samba and Netatalk were under the same management team. Being able to export the same share via multiple protocols is desirable, so some coordination on how filenames and metadata were stored on the host file system was needed. Being able to store a filename as close to the original requested name is always the desired outcome. Since Netatalk was always UNIX based, it tends to be very flexible with filename storage. It didn't have to bend backwards in this case, so it didn't. |
Beta Was this translation helpful? Give feedback.
-
And yet, by Finder's weird naming choice and Netatalk adopting a "No hidden/invisible filesystem attribute? Not my problem." design, the emergent result is a worst-case for UNIX/Unixoid platforms that aren't accessing it through something like Samba's If Samba bends over backwards for Windows that far, isn't it only fair that Netatalk, make a small nod to address a bug that emerges from an odd Macintosh design choice ( It really does feel unreasonable that I need either a network filesystem or a FUSE filesystem to both have custom folder icons in
|
Beta Was this translation helpful? Give feedback.
-
@ssokolow I appreciate all the know-how and research you're sharing in this thread. If I could ask you one favor: Please keep a positive and constructive tone in your messages. The arguably poor design decisions in Netatalk are at least two decades old, and if I read @NJRoadfan's intentions correctly, he is describing the current state rather than defending it. I'm personally not ruling out changing Netatalk's filename mangling behavior. Obviously, a change in such a core part of the application will require careful coding and thorough testing. The absolutely best way to get traction here, would be for you to fork Netatalk, do the requisite code changes, and file a PR back to the project so that we can proceed with code review & testing. We seriously consider all code contributions that adhere to the coding guidelines. Cheers! |
Beta Was this translation helpful? Give feedback.
-
Sorry. I guess my frustration led me to slip on evaluating my phrasing. As for forking and PRs, unfortunately, I don't trust myself to write in a memory-unsafe language for anything long-running, exposed to the network, or more complex than a little MS-DOS (or, when I can make time to resume learning, Classic Macintosh) utility and Netatalk is all three... especially when I'm currently struggling with the effects of bad sleep habits and am more dependant than ever on the Rust compiler to catch my mistakes. "Careful coding and thorough testing" is the last thing I trust myself to do at this point in time. |
Beta Was this translation helpful? Give feedback.
-
No worries; thanks for being open to constructive criticism. :) Doing any kind of substantive change to this C codebase is absolutely terrifying for all of us, with 0% unit test coverage and complex code paths all over the place. But we have at least SonarCloud static analysis and cross-platform CI builds (and human code reviews) to protect us against some of the more obvious bugs. If you ever change your mind, we'll be awaiting your contribution eagerly. BTW, I have only cursory understanding of Rust, but I wonder how memory safety would be achieved for a multi-process / multi-threaded application like Netatalk? How can the compiler anticipate all potential states? |
Beta Was this translation helpful? Give feedback.
-
It's basically the same sort of situation as asking how a type system like C's can anticipate everything. You make certain unlikely-to-be-correct programs (eg. storing integers in two registers and then performing In Rust's case, it's mostly a superset of what's considered good practice in C++ these days, but built into the design of the language and standard library APIs so that you don't have the off-putting degree of annotation clutter and drudgework that would be involved in retrofitting a C codebase with something like splint. There are things where you can't express them in "safe Rust"... but that's why the For example... Common to all architectures:
Multi-threading:
EDIT: For multi-process, there's a limit to how much any one language can do beyond the process-internal things, but there is the typestate pattern, which Rust's de facto standard HTTP implementation is using to good effect, Rust's proven itself good for parsing and serialization/deserialization tasks (See Serde for Rust's de facto standard framework for that, as well as building blocks that make things more comfortable like bytemuck and byteorder), and it just generally helps if you can trust you need to spend less of your energy scrutinizing other aspects of the code because the compiler is watching your back. Granted, it's not a panacea, but there's a reason a lot of people have described it as "makes programming fun again". (eg. leaking memory is safe and there's even an API for it (just call ...and there is one place where As someone who avoids |
Beta Was this translation helpful? Give feedback.
-
Thank you for the Rust crash course. I read through your points and while some of it goes over my head I can see how the structures and safeguards allow for safer coding with the tradeoff of some added complexity in the language itself, and less "freedom" as it were. The reason Rust is on my radar recently, is because DARPA's TRACTOR project was in the news, which promises accurate and safe translation of C to "idiomatic Rust". I believe it when I see it, but it might be an interesting experiment to do on the Netatalk codebase in the future. Anyhow, let me put a pin in the Rust discussion in this thread. Something for another day and another venue! |
Beta Was this translation helpful? Give feedback.
-
As a long time professional C++ developer, and for the past two years Rust programmer and Rust evangelist at my dayjob, I would suggest to not get overhyped on that DARPA thing. Some people on the Rust user language forum did some digging and it is at this stage not even a "we want you to send in research proposal on this for us to grant you money", it is "we think this is a good idea, and we want do a meeting to discuss this and what future research proposal frameworks and guidelines might look like in this area, if it is at all possible". You have to click through a few steps to find out this (special notice -> find the PDF link). I think it will be incredibly difficult to do this automatically (if it is possible at all). I don't buy LLMs managing this. They can often manage short pieces of code (tens to maybe a hundred lines), and may and may not introduce bugs because they are LLMs. But maybe, just maybe there is a chance. You can after all already do this to incredibly non-idiomatic code using c2rust, but the result will be full of |
Beta Was this translation helpful? Give feedback.
-
CLARIFYING EDIT: Every time I write
\r
, I mean a literal0x0D
byte (A.K.A.^M
in Vim), not the string\r
.Is your feature request related to a problem? Please describe.
Currently, my local Linux file manager's view of
/srv/retro
is cluttered up withIcon empty document
entries that I can't get rid of because either the local equivalent to Samba'shide files = ...
option (which is putting a.hidden
file inside the folder with one filename per line) or Dolphin's parsing of it wasn't designed with filenames likeIcon\r
in mind. (NeitherIcon?
norIcon\r
norIcon<literal CR>
work and I don't want to tryIcon*
.)Describe the solution you'd like
Given that the trailing
\r
is probably going to be eaten by every "just do what I mean" implementation of line-splitting under the sun, including ones built into some programming languages, I think it would be an endless slog to identify and fix every implementer of.hidden
that doesn't special-caseIcon\r
, so I think it needs to be fixed on the Netatalk side.The only option I can think of which wouldn't break Samba interop (In fact, it would fix it for those who want that. More on that later.) would be to add a config file option that allows remapping
\r
to something else.(I'd go with generic support for remapping a list of Unicode code points to another list of Unicode code points since that feels like it'd be the best balance of concerns.)
Now about how it would fix Samba interop...
I noticed that I was able to set up my
/srv/retro
with per-platform icons like this:.directory
file inside each folder. Only works remotely ifmount
ed because of how Dolphin's "When is it safe to thumbnail?" logic handles thesmb://
KIOSlave.)desktop.ini
. As long as icon sizes above 48x48px are undefined in the.ico
, sizes 48x48px or below will be used.)desktop.ini
. Windows 7 will downscale the 128x128px icon at any icon size above 48x48px.)At first, I just assumed that OSX had changed how it stored the icon resources (inside
.DS_Store
?) when using the SMB client... until I noticed that I had two un-hidden files in the folder...Icon\r
andIcon
.I didn't see any option to turn it off in the
smb.conf
docs and I honestly like being able to give different icons to PPC-era and Intel-era Mac OS, but either OSX or Samba apparently does remap\r
to
when storingIcon\r
over SMB.The important thing is that I can name files containing
in.hidden
, so, aside from inspiring this solution, we're back to "Netatalk's representation ofIcon\r
is the only thing I can't hide using.hidden
".(At the moment, my solution has been to just
sudo chattr +i **/Icon$'\r' **/._Icon$'\r'
to make sure I don't accidentally delete them from the Linux side of my usually-read only = yes
/srv/retro
share. ...there's also some interaction between the different heterogeneous clients that I haven't tracked down the source of yet that occasionally causes theIcon\r
files to become un-invisibled, but praise-be-to-ad set -f V
, I just have acleanup.sh
script which recursively hides all theIcon\r
andIcon
files and the share is normally read-only anyway.)Describe alternatives you've considered
Icon\r
, but it feels inelegant and potentially vulnerable to "You did that. Why can't you do this too?" scope creep.TheVolumeSettingsFolder
, which I assume would break things like Samba.Additional context
In case you aren't sold on the importance of retaining the ability to keep Netatalk's
Icon\r
separate from SMB'sIcon
, have a screenshot of my in-progress icon set for my/srv/retro
:(Yeah. I haven't started on the 10.4 icons yet, since I'm not yet tooled up for a streamlined workflow on perspective transforms, so I'm just using a couple of standard icons to demonstrate the principle, and you'll just have to take my word for it that Dolphin isn't just honoring
desktop.ini
's icon assignments until I get around to making variants to fit with KDE's Breeze theme.)Beta Was this translation helpful? Give feedback.
All reactions