All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
To: Roland Dreier <roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org>
Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 3/5] read_config: don't try to open file beginning with '.'
Date: Tue, 31 May 2011 23:23:12 +0200	[thread overview]
Message-ID: <1306876992.4475.11.camel@dworkin.quest-ce.net> (raw)
In-Reply-To: <BANLkTimPvmNzOHn8JRkmu=iBU88nNEq9_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

Hi,

Le mardi 31 mai 2011 à 11:42 -0700, Roland Dreier a écrit :
> On Thu, Mar 31, 2011 at 2:29 AM, Yann Droneaud <ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org> wrote:
> > Files beginning with a dot are mostly current and parent directories or,
> > by convention, hidden files.
> >
> > Those path are skipped in find_sysfs_dev().
> 
> Not sure we want to do this. We already skip non-regular files, and
> I'm not sure we want to exclude certain file names.

For example, while testing libibverbs config parsing, I've used emacs to
edit drivers file. And, when emacs open a buffer, it create a lock file
with a leading dot.

So running a libibverbs program prints
libibverbs: Warning: couldn't stat config file
'/tmp/ib/etc/libibverbs.d/.#test'.

Here's a strace output:

open("/tmp/ib/etc/libibverbs.d", O_RDONLY|O_NONBLOCK|O_DIRECTORY|
O_CLOEXEC) = 3
getdents(3, /* 3 entries */, 32768)     = 80
stat("/tmp/ib/etc/libibverbs.d/.#test", 0x7fffe11e8c60) = -1 ENOENT (No
such file or directory)
write(2, "libibverbs: Warning: couldn't st"..., 82) = 82
stat("/tmp/ib/etc/libibverbs.d/.", {st_mode=S_IFDIR|0775,
st_size=4096, ...}) = 0
stat("/tmp/ib/etc/libibverbs.d/..", {st_mode=S_IFDIR|0775,
st_size=4096, ...}) = 0
getdents(3, /* 0 entries */, 32768)     = 0
close(3)                                = 0


Skipping that "normally" hidden file seems a good behavior. Same thing
for those backup files with ~ suffix.

It's mostly harmless, but code which load dynamic modules makes me a
little angry :)

For example, directory libibverbs.d should be owned by root with write
limited write permission, likewise for the driver files.

Regards.

-- 
Yann Droneaud


--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2011-05-31 21:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-31  9:29 [PATCH 0/5] Hardenize libibverbs initialisation Yann Droneaud
     [not found] ` <cover.1301562707.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2011-03-31  9:29   ` [PATCH 1/5] load_drivers: reset the list head after releasing items Yann Droneaud
2011-03-31  9:29   ` [PATCH 2/5] ibverbs_init: " Yann Droneaud
2011-03-31  9:29   ` [PATCH 3/5] read_config: don't try to open file beginning with '.' Yann Droneaud
     [not found]     ` <aa79e6cff5121994d60fb10315ce54e5a2dc63af.1301562707.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2011-05-31 18:42       ` Roland Dreier
     [not found]         ` <BANLkTimPvmNzOHn8JRkmu=iBU88nNEq9_A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-05-31 21:23           ` Yann Droneaud [this message]
2011-03-31  9:29   ` [PATCH 4/5] read_config: ignore directory entry with backup suffix (~) Yann Droneaud
2011-03-31  9:29   ` [PATCH 5/5] read_config_file: ignore driver line without driver name Yann Droneaud
     [not found]     ` <d6d3d428fcea4a4f78287204c00bd40bc7d7a7c5.1301562707.git.ydroneaud-RlY5vtjFyJ3QT0dZR+AlfA@public.gmane.org>
2011-05-31 18:37       ` Roland Dreier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1306876992.4475.11.camel@dworkin.quest-ce.net \
    --to=ydroneaud-rly5vtjfyj3qt0dzr+alfa@public.gmane.org \
    --cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roland-BHEL68pLQRGGvPXPguhicg@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.