nautilus & hidden files

View: New views
20 Messages — Rating Filter:   Alert me  
< Prev | 1 - 2 | Next >

nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

Hello, I would like to have a discussion with you about hidden files.
Nautilus considers hidden the files starting with a dot.
But this is not correct if, for instance we are viewing a ntfs filesystem.
(I don't know if other cases exist for other filesystem types.)

I think that using libntfs-3g it is possible to detect if a file is
hidden, and treat
as so in nautilus.

Thank you.
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Alexander Larsson :: Rate this Message:

| View Threaded | Show Only this Message

On Thu, 2008-10-02 at 19:11 +0200, yelo_3 wrote:
> Hello, I would like to have a discussion with you about hidden files.
> Nautilus considers hidden the files starting with a dot.
> But this is not correct if, for instance we are viewing a ntfs filesystem.
> (I don't know if other cases exist for other filesystem types.)
>
> I think that using libntfs-3g it is possible to detect if a file is
> hidden, and treat
> as so in nautilus.

This is in fact already half-done. Since 2.22 nautilus picks up the
hidden attribute from gio, so all that is needed is for gio to pick up
the hidden attribute from the filesystem. However, I don't know how to
do this for e.g. ntfs.

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

> This is in fact already half-done. Since 2.22 nautilus picks up the
> hidden attribute from gio, so all that is needed is for gio to pick up
> the hidden attribute from the filesystem. However, I don't know how to
> do this for e.g. ntfs.

That's good! we should write to gio mailing list so!
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Alexander Larsson :: Rate this Message:

| View Threaded | Show Only this Message

On Fri, 2008-10-03 at 18:55 +0200, yelo_3 wrote:
> > This is in fact already half-done. Since 2.22 nautilus picks up the
> > hidden attribute from gio, so all that is needed is for gio to pick up
> > the hidden attribute from the filesystem. However, I don't know how to
> > do this for e.g. ntfs.
>
> That's good! we should write to gio mailing list so!

There really isn't a special list for gio. We mostly use bugzilla and
the gtk-devel-list. But I'm the gio maintainer too, so no need to tell
me about this again. :)

If you want to get this working it would help a lot if you did some
research on how an application can get this information from the ntfs
fuse filesystem.

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

I will do some research
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Szabolcs Szakacsits :: Rate this Message:

| View Threaded | Show Only this Message

Alexander Larsson <alexl <at> redhat.com> writes:

> On Fri, 2008-10-03 at 18:55 +0200, yelo_3 wrote:
> > > This is in fact already half-done. Since 2.22 nautilus picks up the
> > > hidden attribute from gio, so all that is needed is for gio to pick up
> > > the hidden attribute from the filesystem. However, I don't know how to
> > > do this for e.g. ntfs.
> >
> > That's good! we should write to gio mailing list so!
>
> There really isn't a special list for gio. We mostly use bugzilla and
> the gtk-devel-list. But I'm the gio maintainer too, so no need to tell
> me about this again. :)
>
> If you want to get this working it would help a lot if you did some
> research on how an application can get this information from the ntfs
> fuse filesystem.

NTFS-3G tries hard to do everything the standard way, so no special
casings are needed. However this support was never requested earlier,
so it wasn't done yet.

How is the hidden file attribute queried for other file systems?

Thanks,   Szaka

--
NTFS-3G: http://ntfs-3g.org

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

I'm new to GIO so I can't help you too much, but this is what I found.

It seems that the hidden attr is stored in GFileInfo*
info->attributes->data[attr_id].value
and you can set attributes using g_file_info_set_attribute

This is how GIO queries for a hidden file, taken from glib2.0-2.18.1,
file gio/gfileinfo.c

/**
 * g_file_info_get_is_hidden:
 * @info: a #GFileInfo.
 *
 * Checks if a file is hidden.
 *
 * Returns: %TRUE if the file is a hidden file, %FALSE otherwise.
 **/
gboolean
g_file_info_get_is_hidden (GFileInfo *info)
{
  static guint32 attr = 0;
  GFileAttributeValue *value;

  g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE);

  if (attr == 0)
    attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN);

  value = g_file_info_find_value (info, attr);
  return (GFileType)_g_file_attribute_value_get_boolean (value);
}


static GFileAttributeValue *
g_file_info_find_value (GFileInfo *info,
                        guint32    attr_id)
{
  GFileAttribute *attrs;
  int i;

  i = g_file_info_find_place (info, attr_id);
  attrs = (GFileAttribute *)info->attributes->data;
  if (i < info->attributes->len &&
      attrs[i].attribute == attr_id)
    return &attrs[i].value;

  return NULL;
}
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Szabolcs Szakacsits :: Rate this Message:

| View Threaded | Show Only this Message


On Sat, 4 Oct 2008, yelo_3 wrote:
> I'm new to GIO so I can't help you too much, but this is what I found.
>
> It seems that the hidden attr is stored in GFileInfo*
> info->attributes->data[attr_id].value
> and you can set attributes using g_file_info_set_attribute

Unfortunately this doesn't help us, ntfs-3g developers. We need to know the
specific system call(s): stat, getxattr, ioctl, etc.

I think you need to dig a bit deeper into the GIO code.

Thanks,
           Szaka

> This is how GIO queries for a hidden file, taken from glib2.0-2.18.1,
> file gio/gfileinfo.c
>
> /**
>  * g_file_info_get_is_hidden:
>  * @info: a #GFileInfo.
>  *
>  * Checks if a file is hidden.
>  *
>  * Returns: %TRUE if the file is a hidden file, %FALSE otherwise.
>  **/
> gboolean
> g_file_info_get_is_hidden (GFileInfo *info)
> {
>   static guint32 attr = 0;
>   GFileAttributeValue *value;
>
>   g_return_val_if_fail (G_IS_FILE_INFO (info), FALSE);
>
>   if (attr == 0)
>     attr = lookup_attribute (G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN);
>
>   value = g_file_info_find_value (info, attr);
>   return (GFileType)_g_file_attribute_value_get_boolean (value);
> }
>
>
> static GFileAttributeValue *
> g_file_info_find_value (GFileInfo *info,
> guint32    attr_id)
> {
>   GFileAttribute *attrs;
>   int i;
>
>   i = g_file_info_find_place (info, attr_id);
>   attrs = (GFileAttribute *)info->attributes->data;
>   if (i < info->attributes->len &&
>       attrs[i].attribute == attr_id)
>     return &attrs[i].value;
>
>   return NULL;
> }
>

--
NTFS-3G:  http://ntfs-3g.org

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

I've digger a little deeper and found glocalfileinfo.c
there are a few getxattr calls in the function
get_one_xattr_from_fd (int         fd,
                       GFileInfo  *info,
                       const char *gio_attr,
                       const char *xattr)

It's a bit long, so I didn't paste it, but these are the most important steps:
g_fgetxattr (fd, xattr, value_p, len); /* macro for fgetxattr */
escape_xattr (info, gio_attr, value_p, len); /* calls the function
g_file_info_set_attribute */

Anyway I dont't know which is the corresponding xattr to
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.

Sorry if I was still not enough helpful, maybe you should wait for
Alexander reply!
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Szabolcs Szakacsits :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, 4 Oct 2008, yelo_3 wrote:

> I've digger a little deeper and found glocalfileinfo.c
> there are a few getxattr calls in the function
> get_one_xattr_from_fd (int         fd,
>       GFileInfo  *info,
>       const char *gio_attr,
>       const char *xattr)
>
> It's a bit long, so I didn't paste it, but these are the most important steps:
> g_fgetxattr (fd, xattr, value_p, len); /* macro for fgetxattr */
> escape_xattr (info, gio_attr, value_p, len); /* calls the function
> g_file_info_set_attribute */
>
> Anyway I dont't know which is the corresponding xattr to
> G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
>
> Sorry if I was still not enough helpful, maybe you should wait for
> Alexander reply!

We may be much closer, thanks. If indeed [f]getxattr(2) is used then we
would only need to know the name of the extended attribute.

Then you could add support in ntfs-3g.c:ntfs_fuse_getxattr(). The hidden
attribute is ni->flags & FILE_ATTR_HIDDEN. Since this code is not critical,
it could be even included in the next stable ntfs-3g release, perhaps in a
week.

At the moment you also need to use the streams_interface=xattr mount option
to support extended attributes. This will be default at some point in the
future.

        Szaka

--
NTFS-3G:  http://ntfs-3g.org
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

is this a possibility?

gfileinfo.h:#define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN
"standard::is-hidden"           /* boolean */
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Szabolcs Szakacsits :: Rate this Message:

| View Threaded | Show Only this Message


On Sat, 4 Oct 2008, yelo_3 wrote:

> is this a possibility?
>
> gfileinfo.h:#define G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN
> "standard::is-hidden"           /* boolean */

I don't think so. Usually they are in the namespace.attribute form, e.g.
user.mime_type, trusted.md5sum, system.posix_acl_access, security.selinux,
etc.

        Szaka

--
NTFS-3G:  http://ntfs-3g.org

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

I'm afraid I can't help you here now, but I will try to investigate.
Let's wait for Alexander Larsson reply.
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

I'm suspecting that when GIO searches for hidden file attribute it
does not search in xattr. Anyway in glocalfileinfo.c a function
extracts xattr tags and automatically converts them to GFileInfo
attributes in this way:
xattr-sys::attr_name (if the xattr tag is not user specific)
xattr:attr_name (if the tag is user specific)

So I think that you can give the xattr name you like for hidden files,
I suggest "system.hidden", which should become (if I understood well)
"xattr-sys:hidden".

The thing we must do in GIO is to add a check to this new tag in the
function g_file_info_get_is_hidden().
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Alexander Larsson :: Rate this Message:

| View Threaded | Show Only this Message

On Sat, 2008-10-04 at 15:17 +0200, yelo_3 wrote:

> I've digger a little deeper and found glocalfileinfo.c
> there are a few getxattr calls in the function
> get_one_xattr_from_fd (int         fd,
>       GFileInfo  *info,
>       const char *gio_attr,
>       const char *xattr)
>
> It's a bit long, so I didn't paste it, but these are the most important steps:
> g_fgetxattr (fd, xattr, value_p, len); /* macro for fgetxattr */
> escape_xattr (info, gio_attr, value_p, len); /* calls the function
> g_file_info_set_attribute */
>
> Anyway I dont't know which is the corresponding xattr to
> G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN.
>
> Sorry if I was still not enough helpful, maybe you should wait for
> Alexander reply!

Eh, gio doesn't currently look for any filesystem hidden attributes for
the reason that I don't know how to do this. Thats why I asked yelo to
investigate how to do this.

How is the hidden attribute exposed by the kernel for native FAT
filesystems. NTFS should probably do it the same way.

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

Well, Szabolcs Szakacsits has told that he could use xattr to expose
the hidden attribute, since GIO can look for xattr attributes.

Is this a good solution in your opinion?
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Alexander Larsson :: Rate this Message:

| View Threaded | Show Only this Message

On Mon, 2008-10-06 at 13:15 +0200, yelo_3 wrote:
> Well, Szabolcs Szakacsits has told that he could use xattr to expose
> the hidden attribute, since GIO can look for xattr attributes.
>
> Is this a good solution in your opinion?

Always looking for xattrs is a performance hit in many cases, since it
will cause loading of another location on the disk. Maybe we can do this
only for filesystems that support this bit though.

Ideally this should not be a NTFS-fuse specific API, but the same should
be availible for e.g. the built-in kernel fat filesystems. We don't want
each filesystem doing something on their own. Maybe this should be
brought up on the linux-kernel mailinglist.

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

Yes you are right, I didn't think about it.
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by yelo_3 :: Rate this Message:

| View Threaded | Show Only this Message

Szaka, in the mean time is there a libntfs-3g call to see if a file is
hidden in ntfs filesystems?
--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list

Re: nautilus & hidden files

by Szabolcs Szakacsits :: Rate this Message:

| View Threaded | Show Only this Message


On Thu, 9 Oct 2008, yelo_3 wrote:

> Szaka, in the mean time is there a libntfs-3g call to see if a file is
> hidden in ntfs filesystems?

No.

You can use 'ntfsinfo -fv -F path/to/file device | grep HIDDEN'

        Szaka

--
NTFS-3G:  http://ntfs-3g.org

--
nautilus-list mailing list
nautilus-list@...
http://mail.gnome.org/mailman/listinfo/nautilus-list
< Prev | 1 - 2 | Next >