On Friday 28 March 2008 20:01, Vladimir Dronnikov wrote:
> Hello!
> 
> Of course I can give an example:
> 
> ---
> timer root:audio 660 >snd/TIMER
> ---
> ( Note the symbols case of rename clause. )
> 
> Current SVN mdev moves /dev/timer to /dev/snd/timer and leaves symlink
> /dev/timer -> snd/timer. Note, not TIMER but timer...

You mean

timer root:audio 660 >snd/anything

moves /dev/timer to /dev/snd/timer, and

timer root:audio 660 >snd/anything/

moves /dev/timer to /dev/snd/anything/timer.

first one seems to be a bug, second one is ok.
The bug is here:

                                dest = strrchr(alias, '/');
                                if (dest) {
                                        if (dest[1] != '\0')
                                                /* given a file name, so rename 
it */
                                                *dest = '\0';
                                        bb_make_directory(alias, 0755, 
FILEUTILS_RECUR);
                                        dest = concat_path_file(alias, 
device_name);
                                        free(alias);
                                } else
                                        dest = alias;

I think this will fix it (and explain the code a bit):

                                dest = strrchr(alias, '/');
                                if (dest) { /* foo -> bar/[baz] ? */
                                        *dest = '\0'; /* mkdir bar */
                                        bb_make_directory(alias, 0755, 
FILEUTILS_RECUR);
                                        *dest = '/';
                                        if (dest[1] == '\0') { /* foo -> bar/ 
-> bar/foo */
                                                dest = concat_path_file(alias, 
device_name);
                                                free(alias);
                                        } else /* foo -> bar/baz */
                                                dest = alias;
                                } else /* foo -> bar */
                                        dest = alias;

> If you like I'll send a patch (draft, may be) to fix this issue.

Yes please. If you want to also deal with ugly for() loop
which parses fields, please do, as a separate patch.
--
vda
_______________________________________________
busybox mailing list
[email protected]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

Reply via email to