]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge branch 'refs/heads/t/autogen'
authorAndre Noll <maan@tuebingen.mpg.de>
Wed, 31 Aug 2022 13:04:00 +0000 (15:04 +0200)
committerAndre Noll <maan@tuebingen.mpg.de>
Wed, 31 Aug 2022 13:04:56 +0000 (15:04 +0200)
A single patch which removes everything from autogen.sh except the
autoconf and autoheader commands.

* refs/heads/t/autogen:
  Simplify autogen.sh.

13 files changed:
NEWS.md
aft.c
audiod.c
client_common.c
command.c
error.h
interactive.c
mood.c
play.c
server.c
string.c
string.h
t/t0004-server.sh

diff --git a/NEWS.md b/NEWS.md
index e9713d9826ff74e25aa01ceaad9a9db13f3113a5..80ae3c4c57305a2bc435a8ac4e76573cedeca3b8 100644 (file)
--- a/NEWS.md
+++ b/NEWS.md
@@ -5,6 +5,9 @@ NEWS
 0.7.1 (to be announced) "digital spindrift"
 -------------------------------------------
 
+- The autogen.sh script now only creates the autoconf specific files
+  but no longer runs configure, make and the test suite.
+
 [tarball](./releases/paraslash-git.tar.xz)
 
 ----------------------------------
diff --git a/aft.c b/aft.c
index 5f9098aa458955d1338bec6183c67493ce798cad..e0bde7fc78c8365f33aa8e5aae9f751a3dabb751 100644 (file)
--- a/aft.c
+++ b/aft.c
@@ -779,18 +779,17 @@ static void write_image_items(struct para_buffer *b, struct afs_info *afsi)
 static void write_filename_items(struct para_buffer *b, const char *path,
                bool basename)
 {
-       char *val;
+       const char *slash;
 
        if (basename) {
                WRITE_STATUS_ITEM(b, SI_basename, "%s\n", path);
                return;
        }
        WRITE_STATUS_ITEM(b, SI_path, "%s\n", path);
-       val = para_basename(path);
-       WRITE_STATUS_ITEM(b, SI_basename, "%s\n", val? val : "");
-       val = para_dirname(path);
-       WRITE_STATUS_ITEM(b, SI_directory, "%s\n", val? val : "");
-       free(val);
+       slash = strrchr(path, '/');
+       WRITE_STATUS_ITEM(b, SI_basename, "%s\n", slash? slash + 1 : path);
+       WRITE_STATUS_ITEM(b, SI_directory, "%.*s\n",
+               slash? (int)(slash - path) : (int)strlen(path), path);
 }
 
 static int print_chunk_table(struct ls_data *d, struct para_buffer *b)
@@ -897,13 +896,13 @@ static int print_list_item(struct ls_data *d, struct ls_options *opts,
                goto out;
        }
        if (opts->mode == LS_MODE_MBOX) {
-               const char *bn = para_basename(d->path);
+               const char *slash = strrchr(d->path, '/');
                para_printf(b,
                        "From foo@localhost %s\n"
                        "Received: from\nTo: bar\nFrom: a\n"
                        "Subject: %s\n\n",
                        last_played_time,
-                       bn? bn : "?");
+                       slash? slash + 1 : "?");
        }
        write_filename_items(b, d->path, lls_opt_given(r_b));
        if (lls_opt_given(r_a))
index 838f375fe6df2c2d96c4bfa2aa41d28e64c29f72..119adbc0be2ddbf24a7d06de4b77a5a3d88bd230 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -749,8 +749,8 @@ static void compute_time_diff(const struct timeval *status_time)
        if (count > 5) {
                int s = tv_diff(&diff, &stat_task->sa_time_diff, &tmp);
                if (tv_diff(&max_deviation, &tmp, NULL) < 0)
-                       PARA_WARNING_LOG("time diff jump: %lums\n",
-                               s * tv2ms(&tmp));
+                       PARA_WARNING_LOG("time diff jump: %c%lums\n",
+                               s < 0? '-' : '+', tv2ms(&tmp));
        }
        count++;
        sa_time_diff_sign = tv_convex_combination(
@@ -1068,7 +1068,7 @@ static int signal_post_select(struct sched *s, void *context)
        case SIGINT:
        case SIGTERM:
        case SIGHUP:
-               PARA_NOTICE_LOG("received signal %d\n", signum);
+               PARA_WARNING_LOG("terminating on signal %d\n", signum);
                task_notify_all(s, E_AUDIOD_SIGNAL);
                return -E_AUDIOD_SIGNAL;
        }
@@ -1094,7 +1094,7 @@ static int command_post_select(struct sched *s, void *context)
                return ret;
        ret = handle_connect(ct->fd, &s->rfds);
        if (ret < 0) {
-               PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+               PARA_NOTICE_LOG("%s\n", para_strerror(-ret));
                if (ret == -E_AUDIOD_TERM) {
                        task_notify_all(s, -ret);
                        return ret;
index 94a6e86544e63824664b114cc400161d4e223684..f8ee80c9d7a01956769284eaa117f1606c59cd76 100644 (file)
@@ -452,8 +452,7 @@ out:
                return 0;
        btr_remove_node(&ct->btrn[0]);
        btr_remove_node(&ct->btrn[1]);
-       if (ret != -E_SERVER_CMD_SUCCESS && ret != -E_SERVER_CMD_FAILURE)
-               PARA_ERROR_LOG("%s\n", para_strerror(-ret));
+       PARA_NOTICE_LOG("closing connection (%s)\n", para_strerror(-ret));
        if (ct->scc.fd >= 0) {
                close(ct->scc.fd);
                ct->scc.fd = -1;
index 5b17f116d53c93956faf60f88d903b233b7e9b69..e3f12931fd9d17fe5489636919a14379d60d0969 100644 (file)
--- a/command.c
+++ b/command.c
@@ -828,7 +828,7 @@ static int run_command(struct command_context *cc, struct iovec *iov)
        }
        perms = server_command_perms[ret];
        if ((perms & cc->u->perms) != perms)
-               return -E_PERM;
+               return -ERRNO_TO_PARA_ERROR(EPERM);
        lcmd = lls_cmd(ret, server_cmd_suite);
        end = iov->iov_base + iov->iov_len;
        for (i = 0; p < end; i++)
diff --git a/error.h b/error.h
index cd5c20ef8f44501429ea8a9ab16b4bfe25d62b54..60c23294d1270c9aa8b4f56d69a1def2f1fac9b8 100644 (file)
--- a/error.h
+++ b/error.h
        PARA_ERROR(OPUS_HEADER, "invalid opus header"), \
        PARA_ERROR(OPUS_SET_GAIN, "opus: could not set gain"), \
        PARA_ERROR(PATH_FOUND, ""), /* not really an error */ \
-       PARA_ERROR(PERM, "permission denied"), \
        PARA_ERROR(PLAYLIST_EMPTY, "attempted to load empty playlist"), \
        PARA_ERROR(PLAYLIST_LOADED, ""), /* not really an error */ \
        PARA_ERROR(PREBUFFER_SUCCESS, "prebuffering complete"), \
index 8c4545b476e8f792ea7bba6f88b4e83fb952e540..041376a1057bcf2e98a4c23c2b23c42d73a68345 100644 (file)
@@ -312,22 +312,27 @@ static int i9e_post_select(__a_unused struct sched *s, __a_unused void *context)
                goto rm_btrn;
        while (input_available()) {
                if (i9ep->stdout_btrn) {
-                       unsigned len = i9ep->key_sequence_length;
-                       assert(len < sizeof(i9ep->key_sequence) - 1);
-                       buf = i9ep->key_sequence + len;
-                       ret = read(i9ep->ici->fds[0], buf, 1);
-                       if (ret < 0) {
-                               ret = -ERRNO_TO_PARA_ERROR(errno);
-                               goto rm_btrn;
+                       while (i9ep->key_sequence_length < sizeof(i9ep->key_sequence) - 1) {
+                               buf = i9ep->key_sequence + i9ep->key_sequence_length;
+                               ret = read(i9ep->ici->fds[0], buf, 1);
+                               if (ret < 0) {
+                                       ret = -ERRNO_TO_PARA_ERROR(errno);
+                                       goto rm_btrn;
+                               }
+                               if (ret == 0) {
+                                       ret = -E_I9E_EOF;
+                                       goto rm_btrn;
+                               }
+                               buf[1] = '\0';
+                               i9ep->key_sequence_length++;
+                               rl_stuff_char((int)(unsigned char)*buf);
+                               rl_callback_read_char();
+                               if (!input_available())
+                                       break;
                        }
-                       ret = -E_I9E_EOF;
-                       if (ret == 0)
-                               goto rm_btrn;
-                       buf[1] = '\0';
-                       i9ep->key_sequence_length++;
-                       rl_stuff_char((int)(unsigned char)*buf);
-               }
-               rl_callback_read_char();
+                       i9ep->key_sequence_length = 0;
+               } else
+                       rl_callback_read_char();
                ret = 0;
        }
        if (!i9ep->stdout_btrn)
diff --git a/mood.c b/mood.c
index a228b2432f9b56d3bc51535c13d74094314e7da9..b3f007b68fe07c46f500d1aaa7dffdfe9503f451 100644 (file)
--- a/mood.c
+++ b/mood.c
@@ -715,9 +715,17 @@ static int reload_current_mood(void)
  * \param pb Unused.
  * \param data Its type depends on the event.
  *
- * This function performs actions required due to the occurrence of the given
- * event. Possible actions include reload of the current mood and update of the
- * score of an audio file.
+ * This function updates the score table according to the event that has
+ * occurred. Two actions are possible: (a) reload the current mood, or (b)
+ * add/remove/update the row of the score table which corresponds to the audio
+ * file that has been modified or whose afs info has been changed. It depends
+ * on the type of the event which action (if any) is performed.
+ *
+ * The callbacks of command handlers such as com_add() or com_touch() which
+ * modify the audio file table call this function. The virtual streaming system
+ * also calls this after it has updated the afs info of the file it is about to
+ * stream (the one with the highest score). If the file stays admissible, its
+ * score is recomputed so that a different file is picked next time.
  *
  * \return Standard.
  */
diff --git a/play.c b/play.c
index 14fac42fd7b6e92566815d4c56b1f4b6b23c88e2..ba9fff70190c7e150b136e15eb5375015897b2d0 100644 (file)
--- a/play.c
+++ b/play.c
@@ -854,6 +854,7 @@ static int com_pause(__a_unused struct lls_parse_result *lpr)
        ss = PARA_MAX(ss, 0UL);
        ss = PARA_MIN(ss, pt->num_chunks);
        pt->start_chunk = ss;
+       pt->rq = CRT_REPOS;
        kill_stream();
        return 0;
 }
index 1020e4fed98ac03d0981d80d517e68abf6e3a76f..e0df714be975b083f4d3cc7116ad0af2501a2b46 100644 (file)
--- a/server.c
+++ b/server.c
@@ -679,12 +679,13 @@ int main(int argc, char *argv[])
                deplete_close_on_fork_list();
                if (ret < 0)
                        PARA_EMERG_LOG("%s\n", para_strerror(-ret));
+               vss_shutdown();
        } else {
+               vss_shutdown();
                alarm(ALARM_TIMEOUT);
                close_listed_fds();
                ret = handle_connect(sct->child_fd);
        }
-       vss_shutdown();
        shm_detach(mmd);
        user_list_deplete();
        free_lpr();
index 198e9f1d286ee2228638a2a7994fe9e65f41ccac..f80331900de09fccf573c18666c3fa007f8ca6bf 100644 (file)
--- a/string.c
+++ b/string.c
@@ -245,56 +245,6 @@ __must_check __malloc char *para_strcat(char *a, const char *b)
        return tmp;
 }
 
-/**
- * Paraslash's version of dirname().
- *
- * \param name Pointer to the full path.
- *
- * Compute the directory component of \p name.
- *
- * \return If \a name is \p NULL or the empty string, return \p NULL.
- * Otherwise, Make a copy of \a name and return its directory component. Caller
- * is responsible to free the result.
- */
-__must_check __malloc char *para_dirname(const char *name)
-{
-       char *p, *ret;
-
-       if (!name || !*name)
-               return NULL;
-       ret = para_strdup(name);
-       p = strrchr(ret, '/');
-       if (!p)
-               *ret = '\0';
-       else
-               *p = '\0';
-       return ret;
-}
-
-/**
- * Paraslash's version of basename().
- *
- * \param name Pointer to the full path.
- *
- * Compute the filename component of \a name.
- *
- * \return \p NULL if (a) \a name is the empty string or \p NULL, or (b) name
- * ends with a slash.  Otherwise, a pointer within \a name is returned.  Caller
- * must not free the result.
- */
-__must_check char *para_basename(const char *name)
-{
-       char *ret;
-
-       if (!name || !*name)
-               return NULL;
-       ret = strrchr(name, '/');
-       if (!ret)
-               return (char *)name;
-       ret++;
-       return ret;
-}
-
 /**
  * Get the logname of the current user.
  *
index 10379a0e83098f392e8653467b826925376eda15..08b9965f57d94b52a19dd231c38b2d53aabb824a 100644 (file)
--- a/string.h
+++ b/string.h
@@ -76,8 +76,6 @@ __printf_2_0 unsigned xvasprintf(char **result, const char *fmt, va_list ap);
 __printf_2_3 unsigned xasprintf(char **result, const char *fmt, ...);
 __must_check __malloc __printf_1_2 char *make_message(const char *fmt, ...);
 __must_check __malloc char *para_strcat(char *a, const char *b);
-__must_check __malloc char *para_dirname(const char *name);
-__must_check char *para_basename(const char *name);
 __must_check __malloc char *para_logname(void);
 __must_check __malloc char *para_homedir(void);
 __malloc char *para_hostname(void);
index 03957464e17e2a50596149e59627cd7584424fe9..9e681107646e85e0fdcc3e12ec1ed13694376628 100755 (executable)
@@ -24,7 +24,8 @@ get_audio_file_paths ogg
 declare -a oggs=($result)
 declare -a oggs_base=(${oggs[@]##*/})
 
-declare -a commands=() cmdline=() required_objects=() good=() bad=()
+declare -a commands=() cmdline=() required_objects=() good=() bad=() \
+       expect_failure=()
 i=0
 commands[$i]="help"
 cmdline[$i]="help -l"
@@ -72,6 +73,15 @@ required_objects[$i]='ogg_afh'
 cmdline[$i]="ls -l=v ${oggs[@]}"
 good[$i]='^attributes_txt: 33'
 
+let i++
+commands[$i]='addmood'
+cmdline[$i]="addmood test-mood"
+
+let i++
+commands[$i]='empty-mood-parameter'
+cmdline[$i]="select m/"
+expect_failure[$i]='true'
+
 let i++
 commands[$i]="term"
 cmdline[$i]="term"
@@ -137,14 +147,19 @@ for ((i=0; i < ${#commands[@]}; i++)); do
                        continue
                fi
        fi
-       test_expect_success "$command" "
+       if [[ -n "${expect_failure[$i]}" ]]; then
+               f=test_expect_failure
+       else
+               f=test_expect_success
+       fi
+       $f "$command" "
        $PARA_CLIENT \
                --loglevel $loglevel \
                --server-port $port \
                --key-file $privkey \
                --config-file /dev/null \
                -- \
-               ${cmdline[$i]} > $command.out &&
+               ${cmdline[$i]} > $command.out < /dev/null &&
                { [[ -z \"${good[$i]}\" ]] || grep \"${good[$i]}\"; } < $command.out &&
                { [[ -z \"${bad[$i]}\" ]]  || ! grep \"${bad[$i]}\"; } < $command.out
        "