symlink fails when basename(filename) is 6 chars long

V.O. Dah li_et_sci at alice-dsl.net
Sat Jul 11 10:11:05 CDT 2009


Hi.
I encountered a strange behaviour of the symlink function.
Octave 3.2.0, linux i686.

Summary: 
symlink fails when symbolik link to be created should point to
a file having a 6 character long basename , *and* if the full filename is given  (i.e. including the full path). 

Demonstration:
Shell, directory /home/alk : 
touch 1
touch 12
touch 123
touch 1234
touch 12345
touch 123456
touch 1234567
touch 12345678

In octave:
octave:12> pwd
ans = /home/alk

[er,me]=symlink("/home/alk/1","link1")
[er,me]=symlink("/home/alk/12","link2")
[er,me]=symlink("/home/alk/123","link3")
[er,me]=symlink("/home/alk/1234","link4")
[er,me]=symlink("/home/alk/12345","link5")
[er,me]=symlink("/home/alk/123456","link6")
[er,me]=symlink("/home/alk/1234567","link7")
[er,me]=symlink("/home/alk/12345678","link8")

No error messages are reported.
Result of ls -l in console: 
 link1 -> /home/alk/1
 link2 -> /home/alk/12
 link3 -> /home/alk/123
 link4 -> /home/alk/1234
 link5 -> /home/alk/12345
 link6 -> /home/alk/123456link6
 link7 -> /home/alk/1234567
 link8 -> /home/alk/12345678

Another example:
In /home/alk :
touch a1.txt
In octave:
[er,me]=symlink("/home/alk/a1.txt","link9")
results:
 link9 -> /home/alk/a1.txtlink9
But:
[er,me]=symlink("a1.txt","link10")
gives:
 link10 -> a1.txt

Another example (invoking symlink from a different directory):
octave:10> pwd
ans = /home/alk/src/mmmm
[er,me]=symlink("/home/alk/1","link1")
[er,me]=symlink("/home/alk/12","link2")
[er,me]=symlink("/home/alk/123","link3")
[er,me]=symlink("/home/alk/1234","link4")
[er,me]=symlink("/home/alk/12345","link5")
[er,me]=symlink("/home/alk/123456","link6")
[er,me]=symlink("/home/alk/1234567","link7")
[er,me]=symlink("/home/alk/12345678","link8")
Results:
link1 -> /home/alk/1
link2 -> /home/alk/12
link3 -> /home/alk/123
link4 -> /home/alk/1234
link5 -> /home/alk/12345
link6 -> /home/alk/123456link6
link7 -> /home/alk/1234567
link8 -> /home/alk/12345678

Sincerely, 
A. Kusmin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www-old.cae.wisc.edu/pipermail/bug-octave/attachments/20090711/7f6d7fa0/attachment.html 


More information about the Bug-octave mailing list