[EGIT] [efm2] 01/01: cleaner code - move file cp to own func etc.
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch master in repository efm2. View the commit online. commit 3519ab0f91340d741a033a9c51a86e5138e84d17 Author: Carsten Haitzler (Rasterman) AuthorDate: Tue Apr 30 17:07:37 2024 +0100 cleaner code - move file cp to own func etc. --- src/backends/default/fs.c | 292 -- 1 file changed, 153 insertions(+), 139 deletions(-) diff --git a/src/backends/default/fs.c b/src/backends/default/fs.c index 403704c..06f6216 100644 --- a/src/backends/default/fs.c +++ b/src/backends/default/fs.c @@ -15,22 +15,30 @@ #include "status.h" #include "fs.h" -// generic error handler. special case handling all errnos for everything is -// pretty insane - so handle non-errors in switches and otherwise pass to -// this tio handle the reast in a generic way. -static void -_error_handle(const char *src, const char *dst, const char *op, int errno_in) +static Eina_Strbuf * +error_strbuf_new(const char *op) { Eina_Strbuf *buf = eina_strbuf_new(); if (!buf) abort(); eina_strbuf_append(buf, op); eina_strbuf_append(buf, ": "); -#define HNDL(_err, _str) \ - _err: \ -eina_strbuf_append(buf, _str); \ -status_error(src, dst, eina_strbuf_string_get(buf)); \ -break + return buf; +} + +// generic error handler. special case handling all errnos for everything is +// pretty insane - so handle non-errors in switches and otherwise pass to +// this tio handle the reast in a generic way. +static void +_error_handle(const char *src, const char *dst, const char *op, int errno_in) +{ + Eina_Strbuf *buf = error_strbuf_new(op); + +#define HNDL(_err, _str) \ +_err: \ + eina_strbuf_append(buf, _str); \ + status_error(src, dst, eina_strbuf_string_get(buf)); \ + break switch (errno_in) { HNDL(case EACCES, "Access denied"); @@ -61,6 +69,120 @@ _error_handle(const char *src, const char *dst, const char *op, int errno_in) eina_strbuf_free(buf); } +static void +error_ok_pos(const char *src, const char *op, const char *str) +{ + Eina_Strbuf *buf = error_strbuf_new(op); + + eina_strbuf_append(buf, str); + status_pos(1, eina_strbuf_string_get(buf)); + eina_strbuf_free(buf); +} + +static Eina_Bool +fs_cp_file(const char *src, const char *dst, const char *op, struct stat src_st) +{ + // copy a normal file from src to dst - use optimized copy range if possible + // and fall abck to read + write into userspace buffer otherwise. use the + // struct stat mode passed in for created file. return true if fully + // successful or false otherwise + int fd_in, fd_ou; + void *old_copy_buf = NULL; + Eina_Bool res = EINA_TRUE; + + fd_in = open(src, O_RDONLY); + fd_ou = open(dst, O_WRONLY | O_CREAT, src_st.st_mode); + if ((fd_in >= 0) && (fd_ou >= 0)) +{ + ssize_t size = 1 * 1024 * 1024; // 1mb default for copy range + ssize_t ret, ret2; + off_t off_in = 0, off_ou = 0; + Eina_Bool old_copy = EINA_FALSE; + + for (;;) +{ + if (old_copy) +{ + if (!old_copy_buf) +{ + size = 256 * 1024; // drop to 256k buffer for r+w + old_copy_buf = malloc(size); + if (!old_copy_buf) +{ + res = EINA_FALSE; + goto err; +} +} +again_read: + ret = read(fd_in, old_copy_buf, size); + if (ret < 0) +{ + switch (errno) +{ +case EAGAIN: +case EINTR: + goto again_read; +default: + _error_handle(src, NULL, op, errno); + res = EINA_FALSE; + goto err; +} +} + else +{ + off_in += ret; +again_write: + ret2 = write(fd_ou, old_copy_buf, ret); + if (ret2 < 0) +{ + switch (errno) +{ +case EAGAIN: +case EINTR: + goto again_write; +default: + _error_handle(NULL, dst, op, errno); + res = EINA_FALSE; + goto err; +} +} + else if (ret2 == ret) +{ + off_ou += ret; + if (ret < size) break; // end of file +} +} +} + else +
[EGIT] [efm2] 01/01: remove command and undef macro in fs.c
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch master in repository efm2. View the commit online. commit f60329683445e71f31f9794b9e5d399dc16ac4e2 Author: Carsten Haitzler (Rasterman) AuthorDate: Tue Apr 30 15:03:30 2024 +0100 remove command and undef macro in fs.c --- src/backends/default/fs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backends/default/fs.c b/src/backends/default/fs.c index 1cb8db9..403704c 100644 --- a/src/backends/default/fs.c +++ b/src/backends/default/fs.c @@ -21,7 +21,6 @@ static void _error_handle(const char *src, const char *dst, const char *op, int errno_in) { - // XXX: Fix str to be Move, Copy or Delete as it can handle any Eina_Strbuf *buf = eina_strbuf_new(); if (!buf) abort(); @@ -58,6 +57,7 @@ _error_handle(const char *src, const char *dst, const char *op, int errno_in) HNDL(case EEXIST, "File exists"); HNDL(default, "Unknown error"); } +#undef HNDL eina_strbuf_free(buf); } -- To stop receiving notification emails like this one, please contact the administrator of this repository.
[EGIT] [efm2] 01/01: handle errs properly in fs code without logic holes
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch master in repository efm2. View the commit online. commit f4b20c1fd870a032a642e2dbd3194c17b64133b2 Author: Carsten Haitzler (Rasterman) AuthorDate: Tue Apr 30 14:46:11 2024 +0100 handle errs properly in fs code without logic holes --- src/backends/default/fs.c | 83 +-- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/src/backends/default/fs.c b/src/backends/default/fs.c index d64fccc..1cb8db9 100644 --- a/src/backends/default/fs.c +++ b/src/backends/default/fs.c @@ -125,6 +125,7 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, mode_t old_umask; struct timeval times[2]; const char*op = ""; + Eina_Strbuf *sbuf = NULL; if (strlen(src) < 1) return EINA_FALSE; @@ -135,19 +136,25 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, else if (!rm && cp) op = "Copy"; else if (rm && !cp) op = "Delete"; + old_umask = umask(0); if (lstat(src, ) != 0) { switch (errno) { case ENOENT: // ignore this error - file removed during scan ? - status_pos(1, "Move - File vanished"); - break; + eina_strbuf_reset(sbuf); + eina_strbuf_append(sbuf, op); + eina_strbuf_append(sbuf, ": "); + eina_strbuf_append(sbuf, "File vanished"); + status_pos(1, eina_strbuf_string_get(sbuf)); + goto err; default: _error_handle(src, dst, op, errno); - return EINA_FALSE; + res = EINA_FALSE; + goto err; } } - old_umask = umask(0); + sbuf = eina_strbuf_new(); if (S_ISDIR(st.st_mode)) { // it's a dir - scan this recursively if (cp) @@ -180,8 +187,8 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, eina_strbuf_append(buf, dst); eina_strbuf_append(buf, "/"); eina_strbuf_append(buf, fs); -if (!fs_cp_rm(s, eina_strbuf_string_get(buf), report_err, - cp, rm)) +if (!fs_cp_rm(s, eina_strbuf_string_get(buf), + report_err, cp, rm)) res = EINA_FALSE; } eina_strbuf_free(buf); @@ -190,21 +197,6 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, } eina_iterator_free(it); } - if ((rm) && (res)) -{ - if (rmdir(src) != 0) -{ - switch (errno) -{ -case ENOENT: // ignore missing - break; -default: - _error_handle(src, NULL, op, errno); - res = EINA_FALSE; - goto err; -} -} -} } else if (S_ISLNK(st.st_mode)) { @@ -217,16 +209,24 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, if ((lnsz > 0) && (lnsz < (ssize_t)sizeof(link))) { if (symlink(link, dst) < 0) -{ // XXX: soft error? e.g. mv on FAT fs? - status_pos(1, "Move - Error creating symlink"); +{ // soft error? e.g. mv on FAT fs? report but move on + eina_strbuf_reset(sbuf); + eina_strbuf_append(sbuf, op); + eina_strbuf_append(sbuf, ": "); + eina_strbuf_append(sbuf, "Error creating symlink"); + status_pos(1, eina_strbuf_string_get(sbuf)); } } else if (lnsz < 0) -{ // XXX: handle read link err +{ switch (errno) { case ENOENT: // ignore this error - file removed during scan ? - status_pos(1, "Move - File vanished"); + eina_strbuf_reset(sbuf); + eina_strbuf_append(sbuf, op); + eina_strbuf_append(sbuf, ": "); + eina_strbuf_append(sbuf, "File vanished"); + status_pos(1, eina_strbuf_string_get(sbuf)); break; default: _error_handle(src, dst, op, errno); @@ -234,7 +234,12 @@ fs_cp_rm(const char *src, const char *dst, Eina_Bool report_err, Eina_Bool cp, } } else // 0 sized symlink ... WAT? -{ // XXX: handle this +{ + eina_strbuf_reset(sbuf); + eina_strbuf_append(sbuf, op); + eina_strbuf_append(sbuf, ": "); + eina_strbuf_append(sbuf, "Zero sized symlink"); + status_error(src, NULL, eina_strbuf_string_get(sbuf)); } } } @@ -243,7 +248,7 @@
[EGIT] [www-content] 01/01: Wiki page ubuntu-start.md changed with summary [Bump Ubuntu version in note about libjxl.] by Philippe Jean Guillaumie
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch master in repository www-content. View the commit online. commit 0cd2a978cc797a4400746a38b56c9bafd649c716 Author: Philippe Jean Guillaumie AuthorDate: Tue Apr 30 04:01:30 2024 -0700 Wiki page ubuntu-start.md changed with summary [Bump Ubuntu version in note about libjxl.] by Philippe Jean Guillaumie --- pages/docs/distros/ubuntu-start.md.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/docs/distros/ubuntu-start.md.txt b/pages/docs/distros/ubuntu-start.md.txt index 147795e95..f9799f1f2 100644 --- a/pages/docs/distros/ubuntu-start.md.txt +++ b/pages/docs/distros/ubuntu-start.md.txt @@ -151,7 +151,7 @@ As well as the dependencies specific for EFL: sudo apt install libssl-dev libsystemd-dev libjpeg-dev libglib2.0-dev libgstreamer1.0-dev liblua5.2-dev libfreetype-dev libfontconfig-dev libfribidi-dev libavahi-client-dev libharfbuzz-dev libibus-1.0-dev libx11-dev libxext-dev libxrender-dev libgl1-mesa-dev libgif-dev libtiff5-dev libpoppler-dev libpoppler-cpp-dev libspectre-dev libraw-dev librsvg2-dev libudev-dev libmount-dev libdbus-1-dev libpulse-dev libsndfile1-dev libxcursor-dev libxcomposite-dev libxinerama-dev libxrandr-dev libxt [...] ``` > **NOTE:** -> Unless you are already running Ubuntu 23.04 or a higher version (simply install libjxl-dev), JPEG XL has to be compiled from source. If you need jxl support in efl, +> Unless you are running Ubuntu 24.04 or a higher version (simply install libjxl-dev), JPEG XL has to be compiled from source. If you need jxl support in efl, > please visit their [GitHub repository](https://github.com/libjxl/libjxl/) for more information. ### Step 3: Configuring the Software ### -- To stop receiving notification emails like this one, please contact the administrator of this repository.
[EGIT] [efm2] 01/01: fix err handling to contain correct operation
This is an automated email from the git hooks/post-receive script. git pushed a commit to branch master in repository efm2. View the commit online. commit 9413ca2e62c1495e3c95b269fd4520c77eb2617b Author: Carsten Haitzler (Rasterman) AuthorDate: Tue Apr 30 09:55:30 2024 +0100 fix err handling to contain correct operation --- src/backends/default/fs.c | 135 ++ src/efm/efm_dnd.h | 1 + 2 files changed, 54 insertions(+), 82 deletions(-) diff --git a/src/backends/default/fs.c b/src/backends/default/fs.c index 53d19d0..d64fccc 100644 --- a/src/backends/default/fs.c +++ b/src/backends/default/fs.c @@ -19,80 +19,46 @@ // pretty insane - so handle non-errors in switches and otherwise pass to // this tio handle the reast in a generic way. static void -_error_handle(const char *src, const char *dst, int errno_in) +_error_handle(const char *src, const char *dst, const char *op, int errno_in) { + // XXX: Fix str to be Move, Copy or Delete as it can handle any + Eina_Strbuf *buf = eina_strbuf_new(); + + if (!buf) abort(); + eina_strbuf_append(buf, op); + eina_strbuf_append(buf, ": "); +#define HNDL(_err, _str) \ + _err: \ +eina_strbuf_append(buf, _str); \ +status_error(src, dst, eina_strbuf_string_get(buf)); \ +break switch (errno_in) { -case EACCES: - status_error(src, dst, "Move - Access denied"); - return; -case EFAULT: - status_error(src, dst, "Move - Memory Fault"); - return; -case ELOOP: - status_error(src, dst, "Move - Too many symlinks"); - return; -case ENAMETOOLONG: - status_error(src, dst, "Move - Name too long"); - return; -case ENOMEM: - status_error(src, dst, "Move - Out of memory"); - return; -case ENOTDIR: - status_error(src, dst, "Move - Path component is not a directory"); - return; -case EOVERFLOW: - status_error(src, dst, "Move - Overflow"); - return; -case EDQUOT: - status_error(src, dst, "Move - Over quota"); - return; -case EINVAL: - status_error(src, dst, "Move - Inmvalid value"); - return; -case EMLINK: - status_error(src, dst, "Move - Too many source links"); - return; -case ENOENT: - status_error(src, dst, "Move - File does not exist"); - return; -case ENOSPC: - status_error(src, dst, "Move - Disk full"); - return; -case EPERM: - status_error(src, dst, "Move - Permission denied"); - return; -case EROFS: - status_error(src, dst, "Move - Read only filesystem"); - return; -case EBADF: - status_error(src, dst, "Move - Bad file descriptor"); - return; -case EIO: - status_error(src, dst, "Move - I/O error"); - return; -case EISDIR: - status_error(src, dst, "Move - Destination is dir"); - return; -case EFBIG: - status_error(src, dst, "Move - File too big"); - return; -case ETXTBSY: - status_error(src, dst, "Move - Text file busy"); - return; -case EBUSY: - status_error(src, dst, "Move - File busy"); - return; -case ENOTEMPTY: - status_error(src, dst, "Move - Destination not empty"); - return; -case EEXIST: - status_error(src, dst, "Move - File exists"); - return; -default: // WAT? we should not get here - we handled everything... - status_error(src, dst, "Move - Unknown error"); - break; + HNDL(case EACCES, "Access denied"); + HNDL(case EFAULT, "Memory Fault"); + HNDL(case ELOOP, "Too many symlinks"); + HNDL(case ENAMETOOLONG, "Name too long"); + HNDL(case ENOMEM, "Out of memory"); + HNDL(case ENOTDIR, "Path component is not a directory"); + HNDL(case EOVERFLOW, "Overflow"); + HNDL(case EDQUOT, "Over quota"); + HNDL(case EINVAL, "Invalid value"); + HNDL(case EMLINK, "Too many links"); + HNDL(case ENOENT, "Does not exist"); + HNDL(case ENOSPC, "Disk full"); + HNDL(case EPERM, "Permission denied"); + HNDL(case EROFS, "Read only filesystem"); + HNDL(case EBADF, "Bad file descriptor"); + HNDL(case EIO, "I/O error"); + HNDL(case EISDIR, "Destination is a directory"); + HNDL(case EFBIG, "File too big"); + HNDL(case ETXTBSY, "Text file busy"); + HNDL(case EBUSY, "File busy"); + HNDL(case ENOTEMPTY, "Destination is not empty"); + HNDL(case EEXIST, "File exists"); + HNDL(default, "Unknown error"); } + eina_strbuf_free(buf); } // this scans a tree to build a potential operation progress count. it may @@ -106,6 +72,7 @@ fs_scan(const char *src) Eina_Iterator *it; const char*s; struct statst; + const char*op = "Scan"; if (strlen(src) < 1) return EINA_FALSE; @@ -116,7 +83,7 @@ fs_scan(const char *src) case ENOENT: // ignore this error -