Tiny Core Base > TCB Bugs
filetool.sh TC 10.1 trivial display bug: trailing slash in output
webb:
--- Code: (bash) ---webb@box ~ filetool.sh -b
Backing up files to /mnt/vda1/tce/mydata.tgz/
Done.
--- End code ---
caused by
--- Code: (bash) ---echo -n
--- End code ---
on line 173 of filetool.sh combined with a following line outputting a slash, maybe
--- Code: (bash) ---sudo /bin/tar -C /
--- End code ---
Rich:
Hi webb
The extra / character is coming from the rotdash (rotating dash) command. The rotdash command writes the following sequence:
--- Code: ---/ Backspace
- Backspace
\ Backspace
| Backspace
--- End code ---
So depending on how long your backup takes, any one of those characters could be left behind. The attached patch file fixes it
by including a leading space character in the next 2 echo commands. That will overwrite the character left by rotdash.
[EDIT]: Moved attachment to the next post. Rich
Rich:
Hi Juanito
The attached patch file does the following:
1. Adds a trailing space to the "Backing up files to $MOUNTPOINT/$FULLPATH/${MYDATA}.tgz" message so that rotdash does not
print right next to the trailing z. This also provides a space if the "encrypting .. " message gets printed which itself will overwrite
anything that rotdash leaves behind.
2. Adds a leading space to the "\nDone." message to overwrite anything that rotdash leaves behind.
Rich:
Hi Juanito
If there's any interest, I have a patch for rotdash that leaves the screen as it found it when it exits. Compiling under TC4 and
using sstrip increases the executables size from 1688 bytes to 1708 bytes. In TC10 I can't get the size under 12324 bytes.
The addition line of code is shown here with a comment and the diff is attached below:
--- Code: ---#include <stdio.h>
#include <unistd.h>
int main(int argc, char **argv){
if (argc != 2) return 1;
const char arr[] = { '/', '-', '\\', '|' };
unsigned int i = 0;
chdir("/proc");
while (access(argv[1],F_OK) == 0) {
printf("%c\b",arr[i]);
fflush(stdout);
i++;
i %= 4;
usleep(100000);
}
// This clears from the cursor to the end of the line leaving
// the screen and cursor as they were when the program started.
printf("\033[K");
return 0;
}
--- End code ---
The source code I used came from here:
http://distro.ibiblio.org/tinycorelinux/4.x/x86/release/src/3.x/rotdash.c
Greg Erskine:
I often output rotdash into a <textarea> on a web page via filetool.sh. The backspace does not work now but it isn't a big problem.
If you add an escape character into the output it would be really bad for displaying via a web page.
I already have replacement rotdash code ready if it is decided you decide to procede.
Example:
--- Code: ---[ INFO ] Backing up files to /mnt/mmcblk0p2/tce/mydata.tgz/-\|/ Done.
[ OK ] Backup successful.
--- End code ---
Navigation
[0] Message Index
[#] Next page
Go to full version