From: "Ihar 'Philips' Filipau" <filia@softhome.net>
To: jw schultz <jw@pegasys.ws>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: OT: why no file copy() libc/syscall ??
Date: Tue, 11 Nov 2003 13:43:59 +0100 [thread overview]
Message-ID: <3FB0D98F.2050504@softhome.net> (raw)
In-Reply-To: <QEg2.3zi.9@gated-at.bofh.it>
jw schultz wrote:
> On Tue, Nov 11, 2003 at 10:51:10AM +0100, Ihar 'Philips' Filipau wrote:
>
>>Florian Weimer wrote:
>>
>>>Andreas Dilger wrote:
>>>
>>>
>>>
>>>>>This is fast turning into a creeping horror of aggregation. I defy
>>>>>anybody
>>>>>to create an API to cover all the options mentioned so far and *not*
>>>>>have it
>>>>>look like the process_clone horror we so roundly derided a few weeks ago.
>>>>
>>>> int sys_copy(int fd_src, int fd_dst)
>>>
>>>
>>>Doesn't work. You have to set the security attributes while you open
>>>fd_dst.
>>
>> int new_fd = sys_copy( int src_fd ); /* cloned copy, out of any fs */
>> fchmod( new_fd, XXX_WHAT_EVER ); /* do the job. */
>> ...
>> flink(new_fd, "/some/path/some/file/name"); /* commit to fs */
>
>
> The associate open file descriptor with a new path system
> call (flink here) has already been rejected for solid
> security reasons.
>
So it was my point - without flink() IMHO it makes no sense.
Just try to imagine any application for sys_copy(char*,char*).
None _I_ _can_ imagine.
"int new_fd = sys_copy( old_fd );" make sense to me - but you need to
have counter-part of it - "flink();" - to commit it to file system.
You really do not need a copy of a file just for copy of a file.
That's what hard link is for.
My way vim/emacs can:
fd = open("originalfile");
new_fildes = copy(fd);
close(fd);
... [do the editing] ...
flink(new_fildes, "newfile"); /* if user decides to save this job */
close(new_fildes);
This make sense - and this is the way usually we do processing of
information. Mimicing cp - is really bad example.
I have re-read thread. I see flink() not as security hole - but they
use should be managed in some way.
Original thread about flink() - everthing doable.
http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=20030406190025%241ec6%40gated-at.bofh.it&rnum=50&prev=/&frame=on
And there was no real security issue given whatsoever.
Only design considerations ;-)
>
> So if you can do it with open file descriptors why do you
> need a new system call?
>
The point, that different fs's can optimize this as they wish.
This would be really nice thing to have in our networked age.
Sshing just to copy huge file - is little bit annoying ;-)
P.S. actually my mind keeps spining idea of cut()/paste(). So file
descriptor without assoc. file path can be useful.
Say:
-----------
fd_part_1 = open("some file");
seek(fd_part_1, 100, 0);
fd_part_2 = cut( fd_part_1 ); /* XXX */
/* here eof(fd_part_1) == 1 && "some file" is truncated to 100b. */
flink(fd_part_2, "second part"); /* create file
with rest of "some file" */
-----------
fd_part_1 = open("some file");
fd_part_2 = open("second part");
paste(fd_part_1, fd_part_2); /* XXX */
/* fd_part_2 is auto close()d
and "second part" file unlinked */
close(fd_part_1);
/* here "some file" will be the same as in the begining */
-----------
This should help video/audio editing much.
P.P.S. not relevant but in any way SUSv3 docs for fattach()
http://www.opengroup.org/onlinepubs/007904975/functions/fattach.html
--
Ihar 'Philips' Filipau / with best regards from Saarbruecken.
-- _ _ _
"... and for $64000 question, could you get yourself |_|*|_|
vaguely familiar with the notion of on-topic posting?" |_|_|*|
-- Al Viro @ LKML |*|*|*|
next parent reply other threads:[~2003-11-11 12:44 UTC|newest]
Thread overview: 77+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <QDtX.2dq.15@gated-at.bofh.it>
[not found] ` <QDtX.2dq.17@gated-at.bofh.it>
[not found] ` <QDtX.2dq.19@gated-at.bofh.it>
[not found] ` <QDtX.2dq.21@gated-at.bofh.it>
[not found] ` <QDtX.2dq.23@gated-at.bofh.it>
[not found] ` <QDtY.2dq.25@gated-at.bofh.it>
[not found] ` <QDtX.2dq.13@gated-at.bofh.it>
[not found] ` <QEg2.3zi.9@gated-at.bofh.it>
2003-11-11 12:43 ` Ihar 'Philips' Filipau [this message]
[not found] <1068512710.722.161.camel@cube.suse.lists.linux.kernel>
[not found] ` <20031111133859.GA11115@bitwizard.nl.suse.lists.linux.kernel>
[not found] ` <20031111085323.M8854@devserv.devel.redhat.com.suse.lists.linux.kernel>
[not found] ` <bp0p5m$lke$1@cesium.transmeta.com.suse.lists.linux.kernel>
[not found] ` <20031113233915.GO1649@x30.random.suse.lists.linux.kernel>
[not found] ` <3FB4238A.40605@zytor.com.suse.lists.linux.kernel>
[not found] ` <20031114011009.GP1649@x30.random.suse.lists.linux.kernel>
[not found] ` <3FB42CC4.9030009@zytor.com.suse.lists.linux.kernel>
2003-11-14 15:26 ` OT: why no file copy() libc/syscall ?? Andi Kleen
2003-11-18 15:49 ` Jamie Lokier
2003-11-18 16:05 ` Andi Kleen
2003-11-18 16:25 ` Trond Myklebust
2003-11-19 13:30 ` Jesse Pollard
2003-11-18 16:58 ` H. Peter Anvin
2003-11-19 2:12 ` Linus Torvalds
2003-11-19 4:04 ` Chris Adams
[not found] <Qvw7.5Qf.9@gated-at.bofh.it>
[not found] ` <QxRl.17Y.9@gated-at.bofh.it>
[not found] ` <Qy0W.1sk.9@gated-at.bofh.it>
[not found] ` <QyaB.1GK.17@gated-at.bofh.it>
[not found] ` <QzSZ.4x1.1@gated-at.bofh.it>
[not found] ` <QCHh.X6.3@gated-at.bofh.it>
2003-11-11 9:51 ` Ihar 'Philips' Filipau
2003-11-11 10:41 ` jw schultz
[not found] ` <QH4e.eV.3@gated-at.bofh.it>
2003-11-11 14:11 ` Ihar 'Philips' Filipau
2003-11-11 15:02 ` Rogier Wolff
2003-11-11 15:31 ` Ihar 'Philips' Filipau
2003-11-11 20:22 ` Jan Harkes
2003-11-11 20:31 ` Valdis.Kletnieks
2003-11-11 1:05 Albert Cahalan
2003-11-11 3:50 ` Andreas Dilger
2003-11-11 4:03 ` Daniel Gryniewicz
2003-11-11 4:14 ` Valdis.Kletnieks
2003-11-11 6:00 ` Andreas Dilger
2003-11-11 8:58 ` Florian Weimer
2003-11-11 10:27 ` jw schultz
2003-11-11 20:08 ` Jan Harkes
2003-11-12 15:36 ` Jesse Pollard
2003-11-20 17:21 ` Florian Weimer
2003-11-20 19:08 ` Jesse Pollard
2003-11-20 19:12 ` Florian Weimer
2003-11-20 19:44 ` Justin Cormack
2003-11-20 20:44 ` Timothy Miller
2003-11-20 21:07 ` Andreas Dilger
2003-11-20 21:30 ` Timothy Miller
2003-11-20 21:49 ` Maciej Zenczykowski
2003-11-20 21:52 ` Timothy Miller
2003-11-20 21:58 ` Hua Zhong
2003-11-22 14:50 ` Pavel Machek
2003-11-22 19:50 ` Jamie Lokier
2003-11-22 23:07 ` Andreas Schwab
2003-11-21 16:24 ` Jesse Pollard
2003-11-20 21:48 ` Maciej Zenczykowski
2003-11-21 16:34 ` Jesse Pollard
2003-11-20 22:31 ` Xavier Bestel
2003-11-20 22:44 ` Andreas Dilger
2003-11-27 2:40 ` Robert White
2003-11-27 7:29 ` Nick Piggin
2003-11-27 9:15 ` David Lang
2003-11-27 8:56 ` Nick Piggin
2003-11-27 9:50 ` David Lang
2003-11-27 10:02 ` Jörn Engel
2003-11-27 10:58 ` David Lang
2003-12-01 16:20 ` Jesse Pollard
2003-11-11 8:52 ` Gábor Lénárt
2003-11-11 13:38 ` Rogier Wolff
2003-11-11 13:53 ` Jakub Jelinek
2003-11-11 13:58 ` David Woodhouse
2003-11-13 20:22 ` H. Peter Anvin
2003-11-13 23:39 ` Andrea Arcangeli
2003-11-14 0:04 ` jw schultz
2003-11-14 0:36 ` H. Peter Anvin
2003-11-14 1:10 ` Andrea Arcangeli
2003-11-14 1:15 ` H. Peter Anvin
2003-11-11 14:11 ` Albert Cahalan
2003-11-12 15:19 ` Jesse Pollard
2003-11-14 3:42 ` Albert Cahalan
-- strict thread matches above, loose matches on Subject: below --
2003-11-10 12:09 Bradley Chapman
2003-11-10 18:47 ` Tomas Konir
2003-11-10 22:44 ` Derek Foreman
[not found] <QiyV.1k3.15@gated-at.bofh.it>
2003-11-10 12:08 ` Ihar 'Philips' Filipau
2003-11-10 13:29 ` Jesse Pollard
2003-11-10 14:22 ` Daniel Jacobowitz
2003-11-11 20:57 ` Jakob Oestergaard
2003-11-10 15:19 ` David Woodhouse
2003-11-10 16:15 ` Jesse Pollard
2003-11-11 12:00 ` davide.rossetti
2003-11-11 12:08 ` Andreas Schwab
2003-11-11 12:23 ` davide.rossetti
2003-11-10 11:33 Davide Rossetti
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=3FB0D98F.2050504@softhome.net \
--to=filia@softhome.net \
--cc=jw@pegasys.ws \
--cc=linux-kernel@vger.kernel.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.