Page 4 of 8

edit bug

Posted: Thu 25 Nov 2010, 00:18
by don570
Pschedule.9

I came across this odd bug while using luci 238

I wanted to put some of the job info into the clipboard.

I selected the command , then clicked on Edit button.

It was easy to put the info into the clipboard,

But I found that the next button that you click is important.

If I click 'Cancel' to get rid of edit window everything is alright,

but if I click 'OK' this prevents me from transfering text to the clipboard again.

That's because the edit window has empty fields as shown in
image (click to enlarge)
Image

I assume this is a bug.

_____________________________________________

Posted: Thu 25 Nov 2010, 08:31
by zigbert
don570
I have read your post 4 times, and still not understanding the bug. Please keep in mind, - I am just a silly Norwegian with very limited global understanding. I have never been one of those smart guys, so maybe a couple of images would help.


Sigmund

Posted: Thu 25 Nov 2010, 12:30
by vovchik
Dear zigbert,

Would this be of any use to you: http://www.murga-linux.com/puppy/viewto ... 615#470615?

With kind regards,
vovchik

bug explained

Posted: Thu 25 Nov 2010, 18:16
by don570
I'll explain how to reproduce the bug step by step.

1) click on a task (or job) on the list. That selects it.
2) Click on edit. That produces the edit window.
3) Copy some command info to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I'll try to reproduce it again and report back this weekend.
I should have tried another puppy variant.

discovered problem with ampersand

Posted: Fri 26 Nov 2010, 17:57
by don570
There is problem with ampersand.
try command
touch test&&.txt
and go thru steps in previous post.


and try commands of my previous post of month ago

maybe other symbols as well

Edit:

try a better example

Code: Select all

touch test1  &&  touch test2

Posted: Sat 27 Nov 2010, 09:17
by zigbert
vovchik wrote:Dear zigbert,

Would this be of any use to you: http://www.murga-linux.com/puppy/viewto ... 615#470615?

With kind regards,
vovchik
Thanks for sharing, - I'll keep it in mind :wink:


Sigmund

Posted: Sat 27 Nov 2010, 09:18
by zigbert
Don570
will look at your trouble a bit later.......


Sigmund

Posted: Wed 01 Dec 2010, 08:42
by zigbert
Version 0.9-2
See main post

Changelog
- Bugfix: Accept & in command (thanks to don570)
- Bugfix: Wrong Title in error-box.

Re: bug explained

Posted: Wed 01 Dec 2010, 08:44
by zigbert
don570 wrote:I'll explain how to reproduce the bug step by step.

1) click on a task (or job) on the list. That selects it.
2) Click on edit. That produces the edit window.
3) Copy some command info to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I'll try to reproduce it again and report back this weekend.
I should have tried another puppy variant.
I could still not reproduce this in Puppy 5.1.1. In case this is related to the &-bug, please tray 0.9-2


Thanks
Sigmund

bug with ampersand

Posted: Sat 04 Dec 2010, 21:29
by don570
The only bug I had was with the ampersand.
I'll test the fix and report.

explanation of ampersand bug

Posted: Mon 06 Dec 2010, 23:54
by don570
I didn't explain the ampersand bug very clearly.
It doesn't refer to a variable name having an
ampersand character.

What I was doing was to connect two commands with a double
ampersand &&

This is a method that I like
to use to complete one command completely then start another command.

The example I used was

Code: Select all

cd /mnt/sda5 && arecord -d 7200 -f cd -D hw  out2.wav
This worked well in previous versions of pschedule, but then I
got ambitious and tried to see if I could edit the line in pschedule.
So here is what I did.

1) click on the task (or job) on the list. That selects it.
2) Click on edit button ---> That produces the edit window.
3) Copy some of command line to clipboard.
4) Now click on OK button
5) Click on edit button a second time and command field is now empty.
It shouldn't be empty.

I concluded that the ampersand character is causing pschedule
to become confused.

What I suggest is that when the edit button is clicked , a check for
the double ampersand is made and when the OK button is clicked,
reconstruct the two commands back together so that there is
some sense to the line of code again.

If that's too hard to do then you'd better go back to previous version.

I'm sorry for the confusion.

___________________________________________________

design to handle double ampersand

Posted: Tue 07 Dec 2010, 20:10
by don570
I quickly drew up a design to show how to handle the double ampersand.

When the edit button is clicked , there would be a search for the double
ampersand in the task and if it was found, this window would appear.
Each command could be edited separately. Then click on the OK button
when the editing is concluded.


Image


Once the edit window closes the two commands can be recombined
into one line of code and the regular window used.
____________________________________________________

Posted: Wed 08 Dec 2010, 18:29
by zigbert
don570
I have made some more testing, I find the latest (0.9-2) to work as expected. Please be aware of
- it adds a \ in front of the &. This prints the text-string (with &) correct, and you can edit the cron-task without corrupting the command.
- Adding a & to the command to run in background seems to me not logical, since cron itself continues after execution.
- To execute several commands in one cron-task, you should use the separator ';'


Sigmund

Re: explanation of ampersand bug

Posted: Wed 08 Dec 2010, 19:37
by RetroTechGuy
don570 wrote:I didn't explain the ampersand bug very clearly.
It doesn't refer to a variable name having an
ampersand character.

What I was doing was to connect two commands with a double
ampersand &&

This is a method that I like
to use to complete one command completely then start another command.

The example I used was

Code: Select all

cd /mnt/sda5 && arecord -d 7200 -f cd -D hw  out2.wav
I thought that the standard Linux method to chain commands was the semi-colon ";"

So your command becomes:

Code: Select all

cd /mnt/sda5 ; arecord -d 7200 -f cd -D hw  out2.wav
I'm somewhat wary of "&" since that's the standard "background this process" command.

Thus, something like this:

Code: Select all

./go_run_this_tedious_code_and_dont_bother_me_until_you_are_done -f go_away.dat &
would go into the running processes, leaving your command prompt available for further commands.

Some other useful commands:

When a process is running from your command prompt: ^z = (control-z) suspend current process
To "background" that process: bg
To bring that backgrounded process back to the command prompt ("foreground"): fg

and so forth...

double ampersand

Posted: Thu 09 Dec 2010, 23:15
by don570
I think I learned about the double ampersand when
I read a book about Unix a couple of years ago.
Linux does things different obviously.
When in Rome do as the Romans do.

_________________________________________

Re: double ampersand

Posted: Thu 09 Dec 2010, 23:22
by RetroTechGuy
don570 wrote:I think I learned about the double ampersand when
I read a book about Unix a couple of years ago.
Linux does things different obviously.
I think I learned that under SunOS (erm...a couple decades ago)... Which also worked under Slackware, Debian, etc...
When in Rome do as the Romans do.
When incognito, do as the cognito do... :lol:

double ampersand

Posted: Fri 10 Dec 2010, 01:31
by don570
I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
_______________________________________

Re: double ampersand

Posted: Fri 10 Dec 2010, 16:46
by RetroTechGuy
don570 wrote:I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
Aha! That's a valid reason to have such a command, in addition to ";" (which runs regardless)

I learned something new today! Thanks Don!
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
Well, most people don't even use the command line any more, so...

I guess that I was aware that "&&" also worked, but because "&" is a "special character", I avoided it. From the error standpoint, I find that ";" is more well behaved -- and when it doesn't work, it doesn't do exceptionally strange things -- like backgrounding jobs... :wink:

BTW, it rather looked like part of the problem was that characters we being "quoted" rather than being operators...

There's that whole goofy list of special characters, such as: "&" versus "\&" and what's the really goofy one..."\\" which quotes "" as a character (I _think_)? ("" being the special character used for quoting, is difficult to "quote", so you have to "quote" it again...or is it twice more?)

Urgh!!!...

Re: double ampersand

Posted: Fri 10 Dec 2010, 18:54
by jpeps
RetroTechGuy wrote:
don570 wrote:I remember now . I was installing netbsd unix
on an old mac computer and I started
reading about unix.

Here's the reference

Visual Quickstart Guide
Unix Third Edition

by Deborah S. Ray and Eric J. Ray

Code: Select all

If you use && to combine commands,
the system will run both in sequence but
run the second only if the first succeeds.
For example, you could use 

mv  todolist  todolist.done  &&  touch todolist 

to move your to-do list to a different file and
create a new to-do list.  If the first command 
fails  (for example, because you don't have 
permission to create a new file),  the second 
command won't run.
Aha! That's a valid reason to have such a command, in addition to ";" (which runs regardless)

I learned something new today! Thanks Don!
With Puppy linux there isn't many permissions issues,
so nobody uses the double ampersand.
Now I understand the confusion.
Mostly I see "&&" used after after tests. If using ";" it's just a new line of code....quite different.

Code: Select all

[ "$1" = "" ] && echo "no arguments here" && exit 

Posted: Sun 23 Jan 2011, 13:18
by zigbert
Version 0.9-3
See main post

Changelog
- New parameters to manage Pschedule from external apps
--> -e : edit a already defined command
--> -s : run silent. Do not show main window.

This makes it possible to use the Pschedule editor in other apps. Will be used by Pmusic 1.6.0