[Scilab-users] file permission and demo_gui()

classic Classic list List threaded Threaded
11 messages Options
jbaudais jbaudais
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] file permission and demo_gui()

Hello,

  When I installed Scilab, I unziped the file on my home directory. The permission for all files is read only, and execute if needed. Then, the demo_gui() needs to be executed twice to work.

The first time, in file demo_gui.sci:
- line 54, the permission of 'File' is read only;
- line 55, 'File2' has not been created yet;
- line 58, 'File2' is created with the same permission as 'File';
- line 65, 'xmlWrite' cannot write because of read permission only and demo_gui() stops with the error message "Cannot write the file...".

The second time 'File2' exists, then demo_gui() works.

By default, unzip doesn't change the permission, timestamp... So, is it a bug?

--
Jean-Yves Baudais
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

Hello Jean-Yves,
Never met this issue. It looks proper to your install. Could you please
post the actual full error message? Presently, we don't know if you are
analyzing the issue, or if you -- partially -- report it. In addition to
the described installation, the full error message would definitely help.
Thanks
Samuel


Le 23/12/2020 à 11:46, Jean-Yves Baudais a écrit :

> Hello,
>
>    When I installed Scilab, I unziped the file on my home directory. The permission for all files is read only, and execute if needed. Then, the demo_gui() needs to be executed twice to work.
>
> The first time, in file demo_gui.sci:
> - line 54, the permission of 'File' is read only;
> - line 55, 'File2' has not been created yet;
> - line 58, 'File2' is created with the same permission as 'File';
> - line 65, 'xmlWrite' cannot write because of read permission only and demo_gui() stops with the error message "Cannot write the file...".
>
> The second time 'File2' exists, then demo_gui() works.
>
> By default, unzip doesn't change the permission, timestamp... So, is it a bug?
>

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

Le 23/12/2020 à 14:35, Samuel Gougeon a écrit :

>
> Le 23/12/2020 à 11:46, Jean-Yves Baudais a écrit :
>> Hello,
>>
>>    When I installed Scilab, I unziped the file on my home directory.
>> The permission for all files is read only, and execute if needed.
>> Then, the demo_gui() needs to be executed twice to work.
>>
>> The first time, in file demo_gui.sci:
>> - line 54, the permission of 'File' is read only;
>> - line 55, 'File2' has not been created yet;
>> - line 58, 'File2' is created with the same permission as 'File';

This is an issue, because File2 is copied from File in your TMPDIR where
all files are assumed to be writable.

>> - line 65, 'xmlWrite' cannot write because of read permission only
>> and demo_gui() stops with the error message "Cannot write the file...".
>>
>> The second time 'File2' exists, then demo_gui() works.

Yes, because File2 exists, but has not been possibly updated according
to your Preferences=>General demo GUI  preference.

I will try to test by forcing File permissions on my system, and see
what copyfile() does.


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

Le 23/12/2020 à 14:58, Samuel Gougeon a écrit :
>
> Yes, because File2 exists, but has not been possibly updated according
> to your Preferences=>General demo GUI  preference.
>
> I will try to test by forcing File permissions on my system, and see
> what copyfile() does.


On Windows, using copyfile() to copy a non-writeable source file does
not keep the non-writeable status for the destination copy: the copy is
writeable.
For the time being i have no access to any Linux session to test, but
readers working on Linux may test and confirm (or nor).


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jbaudais jbaudais
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

In reply to this post by Samuel GOUGEON
> Never met this issue. It looks proper to your install. Could you please
> post the actual full error message? Presently, we don't know if you are
> analyzing the issue, or if you -- partially -- report it. In addition to
> the described installation, the full error message would definitely help.

I analyzed and detailled the issue. The full message is

--> demo_gui()
at line    49 of function demo_gui ( SCI/modules/demo_tools/macros/demo_gui.sci line 65 )
xmlWrite: Cannot write the file: /tmp/SCI_TMP_22935_iLRVVA/demo_gui_dockable.xml


Notes that the permission of /tmp/SCI_TPM_22935/ directory is 'wrx'. All created files by Scilab in /tmp/SCI_TMP_22935/ are 'wr' ones, except demo_gui_dockable.xml (because of the use of copyfile function and because of the original file permissions).

--
Jean-Yves
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

Le 23/12/2020 à 18:14, Jean-Yves Baudais a écrit :
> I analyzed and detailled the issue. The full message is
>
> --> demo_gui()
> at line    49 of function demo_gui ( SCI/modules/demo_tools/macros/demo_gui.sci line 65 )
> xmlWrite: Cannot write the file: /tmp/SCI_TMP_22935_iLRVVA/demo_gui_dockable.xml
>
>
> Notes that the permission of /tmp/SCI_TPM_22935/ directory is 'wrx'.

Thank you for this confirmation and additional information.

> All created files by Scilab in /tmp/SCI_TMP_22935/ are 'wr' ones, except demo_gui_dockable.xml (because of the use of copyfile function and because of the original file permissions).


This is really the point. This copyfile behaviour looks proper to Linux.
More tests about it would be required, and compared to file permissions
coming from unix("cp ...")

If your first results are confirmed, as well from other Linux users, it
will be clearly an issue to address ASAP.

Best regards
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jbaudais jbaudais
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

In reply to this post by Samuel GOUGEON
> I will try to test by forcing File permissions on my system, and see
> what copyfile() does.


I tested for different combinaison of permissions ('w', 'r', 'x'): copyfile() keeps them unchanged. (Permissions are kept for 'user' only, I guess permission mask or something like that for 'group' and 'other'.)

--
Jean-Yves
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jbaudais jbaudais
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

> I tested for different combinaison of permissions ('w', 'r', 'x'): copyfile()
> keeps them unchanged. (Permissions are kept for 'user' only, I guess permission
> mask or something like that for 'group' and 'other'.)


I forgot: That 'permission mask' for 'group' and 'other' is fixed by Linux system or user account, I don't know, but clearly it does not depends on Scilab.

--
Jean-Yves
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

In reply to this post by jbaudais
Le 23/12/2020 à 18:40, Jean-Yves Baudais a écrit :
I will try to test by forcing File permissions on my system, and see
what copyfile() does.

I tested for different combinaison of permissions ('w', 'r', 'x'): copyfile() keeps them unchanged. (Permissions are kept for 'user' only, I guess permission mask or something like that for 'group' and 'other'.)


copyfile has no option to force permissions of the copy.
You might do and test the following:

  1. replace the copyfile instruction with a mgetl + mputl combination:
    // r = copyfile(File, File2);

    r
    = mgetl(File);
    mputl
    (r, File2);

  2. exec demo_gui.sci to update it

  3. Remove demo_gui_dockable.xml in TMPDIR, or just exit and run a new session (so with a new TMPDIR)

  4. run demo_gui(), and play with its dockable preferences.


If it works, i will push a patch for Scilab 6.1.1. Anyway the copyfile issue would have to be addressed. Since copyfile() is used 18 times within Scilab, other issues elsewhere could be expected. At least, the fact that permissions are kept should be documented in the copyfile help page.



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
jbaudais jbaudais
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

> You might do and test the following:
>
>    1. replace the copyfile instruction with a mgetl + mputl combination: // r =
>    copyfile(File, File2); r = mgetl ( File ) ; mputl ( r , File2 ) ;
>    2. exec demo_gui.sci to update it
>    3. Remove demo_gui_dockable . xml in TMPDIR, or just exit and run a new session
>    (so with a new TMPDIR)
>    4. run demo_gui(), and play with its dockable preferences.
>
> If it works, i will push a patch for Scilab 6.1.1. Anyway the copyfile issue
> would have to be addressed. Since copyfile() is used 18 times within Scilab,
> other issues elsewhere could be expected. At least, the fact that permissions
> are kept should be documented in the copyfile help page.


For me, it's ok and now demo_gui() works: The permission of the demo_gui_dockable.xml file in TMPDIR is now read and write.

--
Jean-Yves
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: file permission and demo_gui()

Le 23/12/2020 à 19:40, Jean-Yves Baudais a écrit :
You might do and test the following:

   1. replace the copyfile instruction with a mgetl + mputl combination: // r =
   copyfile(File, File2); r = mgetl ( File ) ; mputl ( r , File2 ) ;
   2. exec demo_gui.sci to update it
   3. Remove demo_gui_dockable . xml in TMPDIR, or just exit and run a new session
   (so with a new TMPDIR)
   4. run demo_gui(), and play with its dockable preferences.

If it works, i will push a patch for Scilab 6.1.1.
.../...

Done

For me, it's ok and now demo_gui() works: The permission of the demo_gui_dockable.xml file in TMPDIR is now read and write
--
Jean-Yves



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users