You are not logged in.

#1 2020-04-10 20:34:11

jfk
Member
Registered: 2017-12-11
Posts: 131

Hidden file interpreted as an improper extension

My .xinitrc file is now interpreted as a type of audio file "audio soundtracker Amiga". Nothing serious but I'd like to know whether we can do something about it.

Apparently the extension .xi is linked to Amiga weirdly conflicting with the hidden function of files grammar. I looked for MIME editors but as I got it they don't allow to change the relationship between the extension and a type of file. 

Thanks

Last edited by jfk (2020-04-10 20:35:27)

Offline

#2 2020-04-10 20:36:46

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: Hidden file interpreted as an improper extension

There is no relation between extension and file type. Extensions are irrelevant in linux.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2020-04-10 20:41:18

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

OK but you understood what I'd like to achieve. How would you solve that?

Offline

#4 2020-04-10 21:07:03

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,426
Website

Re: Hidden file interpreted as an improper extension

"Interpreted" by what?


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

#5 2020-04-10 21:36:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,520
Website

Re: Hidden file interpreted as an improper extension

jfk wrote:

OK but you understood what I'd like to achieve

I'm not sure about anyone else, but I certainly don't have a clue what you are trying to acheive.  Notably, the following doesn't make any sense:

jfk wrote:

... conflicting with the hidden function of files grammar.

There is no hidden function, and files' grammer ... there is no grammar.

I gather that some program is trying to do something with your .xinitrc because that program assumes it is an audio file.  That's really all you've given us.  What program is behaving incorrectly, and what exactly is it doing that you'd like to change?


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2020-04-10 22:06:51

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

OK let me rephrase (I'm not a native).

What I meant by "hidden function of files grammar" is just how files managers display or not a file when a dot is placed before the name of the file.

There is a "conflict" because this way of handling files display is the same way for files association managers to read the type of the file. Thus, as it is the case in my situation, it's possible for the dot to have two functions at the same time, "being hidden" and "being a type of file" - namely when a "name" ends up being simultaneously a "type of file".

I simply want to know how I can tell the files association manager to stop telling me that my ".xinitrc" is an audio file without appending for instance a ".xinitrc.txt". Where should I go?

I hope it's clearer.

Thanks

Offline

#7 2020-04-10 22:08:57

loqs
Member
Registered: 2014-03-06
Posts: 19,078

Re: Hidden file interpreted as an improper extension

What file manager is this?

Offline

#8 2020-04-10 22:25:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,520
Website

Re: Hidden file interpreted as an improper extension

jfk wrote:

... how I can tell the files association manager to stop telling me that my ".xinitrc" is an audio file

What file association manager, and how is it "telling" you this?  Are you referring to the icon shown in a file manager?  If so, which file manager?  If not, then you still need to describe what is actually happening.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#9 2020-04-10 22:45:01

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

loqs wrote:

What file manager is this?

pcmanfm-qt(-git)

Trilby wrote:

What file association manager, and how is it "telling" you this?

File association in LxQt works with XDG and MIME. The GUI is lxqt-config-file-associations

Therefore, in pcmanfm the colon "Type" says that my ".xinitrc" is "audio Amiga" because an app associates ".xi" (according to lxqt-config-file-associations) to "audio Amiga". I mean it's weird.

Last edited by jfk (2020-04-10 22:45:58)

Offline

#10 2020-04-10 23:24:03

loqs
Member
Registered: 2014-03-06
Posts: 19,078

Re: Hidden file interpreted as an improper extension

xdg-mime query filetype ~/.xinitrc
file ~/.xinitrc

Offline

#11 2020-04-11 11:14:40

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

loqs wrote:
xdg-mime query filetype ~/.xinitrc
file ~/.xinitrc

Interesting, I got 'text/plain' (as it should be) but still 'audio Amiga' in the environment. I guess there's a bug in lxqt-config-file-associations.

Thanks for your replies though.

Offline

#12 2020-04-11 11:22:28

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,421

Re: Hidden file interpreted as an improper extension

sounds like something in your xinitrc may be off as I get slightly different results.

$ xdg-mime query filetype ~/.xinitrc
text/x-shellscript
$ file ~/.xinitrc 
/home/panoramix/.xinitrc: POSIX shell script, ASCII text executable
$ 

Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#13 2020-04-11 13:04:28

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,520
Website

Re: Hidden file interpreted as an improper extension

No, text/plain is correct.  Attempting to put a shebang on the first line will make it register as text/x-shellscript, but that's not actually a shebang, just a comment - there is no reason for it to be in an xinitrc.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#14 2020-04-12 13:42:56

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 15,421

Re: Hidden file interpreted as an improper extension

The default archlinux file in /etc/X11/xinit/xinitirc has that shebang , and it does appear to come from upstream.

Other then that I do think OP is likely facing  a bug in pcmanfm-t


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#15 2020-04-12 14:03:44

loqs
Member
Registered: 2014-03-06
Posts: 19,078

Re: Hidden file interpreted as an improper extension

@Lone_Wolf see https://gitlab.freedesktop.org/xorg/app … nit.c#L135

#ifndef SHELL
#define SHELL "sh"
#endif

....

static char *default_client[] = {"xterm", "-geometry", "+1+1", "-n", "login", NULL};
static char *clientargv[100];
static char **client = clientargv + 2; 

....

static void
Execute(char **vec)		/* has room from up above */
{
    execvp(vec[0], vec);
    if (access(vec[0], R_OK) == 0) {
	vec--;				/* back it up to stuff shell in */
	vec[0] = SHELL;
	execvp(vec[0], vec);
    }
    return;
}

So xinitrc is started by sh if xinitrc can not be executed.
Edit:
Corrected the hash bang will be used if present and the file can be executed.

Last edited by loqs (2020-04-12 15:57:59)

Offline

#16 2020-04-13 15:32:19

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

FYI

After chatting on Github, the installation of

perl-file-mimeinfo

gives me a different outcome, more consistant with what it is displayed

$ xdg-mime query filetype ~/.xinitrc
audio/x-mod

xinitrc being set without shebang

if [ -d /etc/X11/xinit/xinitrc.d ] ; then
 for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do
  [ -x "$f" ] && . "$f"
 done
 unset f
fi

exec startlxqt

Last edited by jfk (2020-04-13 15:34:02)

Offline

#17 2020-04-13 15:47:57

loqs
Member
Registered: 2014-03-06
Posts: 19,078

Re: Hidden file interpreted as an improper extension

Offline

#18 2020-04-13 16:06:45

jfk
Member
Registered: 2017-12-11
Posts: 131

Re: Hidden file interpreted as an improper extension

Yeah that's it thank you.

What a weird bug.

Offline

#19 2020-04-13 17:03:01

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,520
Website

Re: Hidden file interpreted as an improper extension

After the installation of perl-*:

jfk wrote:

What a weird bug.

'Bout right.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#20 2020-04-13 22:22:52

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: Hidden file interpreted as an improper extension

Slithery wrote:

There is no relation between extension and file type. Extensions are irrelevant in linux.

That's actually incorrect. What would be correct would be to say that while on Windows, an extension *is* the file type, on Linux, filetypes are based on probing the file through several mechanisms -- and the shared-mime-info database used by XDG permits you to perform probes based on extension. Extensions can, sometimes, be very useful especially as a tiebreaker between several possible content analyses.

And the /usr/bin/file utility can also emit mimetype strings, but it does so using an internal database unrelated to the shared-mime-info one, which only supports "file magic" (header bytes and other content checks) .

The shared-mime-info standard also permits looking for file magic using the descriptions directly based on file's magic(5), whether that is considered to override the extension globbing if they come into conflict is determined by the relative weights: https://specifications.freedesktop.org/ … 3656681504


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB