20200219_jeffrey - silenceuncrio/diary GitHub Wiki

0900

review


update 20200217_jeffrey 關於 bgp 要先作在哪邊的判斷

目前 M360P[release/v1.06] 已 merge 回 M360P[develop]

直接先在 M360P[develop] 作 BGP Status


m350 針對以下 issue 的修正

  • 0000918: after apply ok with 'Work As' field changed, sometimes the value will be kept the old one

底層 icos 負責同仁已從源頭解決

把相關的 code 移除以避免不必要的誤會

m350[develop] - remove the workaround since the problem fixed at the right point

commit 38fcc45697375ac00ecaced0719e3c088cd8c815
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Feb 19 09:13:44 2020 +0800

    remove the workaround since the problem fixed at the right point

 proscend/prosrc/webcgi/connmgr.c | 10 ----------
 1 file changed, 10 deletions(-)

0925

兩個較優先的項目待處理 一個 task 一個 issue


先解決 issue

這 issue 會影響使用者對我們產品的印象 - 雖然是偶爾發生


問題可以從 jweb.c 的 access_filter() 追起

static void access_filter(int level, void (*callback)(void))
{
    session_t *session = get_session();
    if (session == NULL)
    {
        jweb.http.status(401);
        jweb.out.json.fail("access level invalid");
    }
    else
    {
        if (level <= get_user_level_by_name(session->user))
        {
            callback();
            return;
        }
        else
        {
            http_status(401);
            json_fail("access level invalid");
        }
    }
}

不過我兩個不同錯誤的點回報的訊息都一樣

先改一下

m350[develop] - output information base on different error

commit d97d6ee43cc6edacb7ed1c68eddb84f2908d0eba
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Feb 19 10:00:59 2020 +0800

    output information base on different error

 proscend/prosrc/webcgi/jweb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

注意

firmware upgrade 時

web.log 會被 lighttpd 本身這個 process 塞爆

root@ICR-401:/home/admin# ps | grep 2997
 2997 root      3996 S    lighttpd -D -f /tmp/icos/web/lighttpd.conf
13827 root      1652 S    grep 2997

被塞爆的 log 如下

root@ICR-401:/home/admin# cat /home/log/web.log
1582041511[20200218 15:58:31] [msgcb_web:1427]IN(DID1,pid 2997)
1582041511[20200218 15:58:31] [msgcb_web:1427]IN(DID1,pid 2997)
1582041511[20200218 15:58:31] [msgcb_web:1427]IN(DID1,pid 2997)
...
<大約有 3xxx 行>
...
1582041518[20200218 15:58:38] [msgcb_web:1427]IN(DID1,pid 2997)
1582041518[20200218 15:58:38] [msgcb_web:1427]IN(DID1,pid 2997)
1582041518[20200218 15:58:38] [msgcb_web:1427]IN(DID1,pid 2997)
1582041519[20200218 15:58:39] [notify_web:1057]IN(E184|S44|D44)
1582041519[20200218 15:58:39] [notify_web:1072]Receive: { "upgrading": "no" }
1582041519[20200218 15:58:39] [notify_web:1086]ICOS_shm_status_update(SHM_FIRMWARE_UPGRADING, 0, NULL)
root@ICR-401:/home/admin#

過程還發現 whoAmI 回報 level 為 0

image

處理的 function 如下

static void api_whoAmI(void)
{
    session_t *session = get_session();
    if (session == NULL)
    {
        json_whoAmI(GUEST_NAME, 0); // 0 - M300:guest
        json_ok();
    }
    else
    {
        // find user in session store and get the access level of that user
        int level = get_user_level_by_name(session->user);
        json_whoAmI(session->user, level);
        json_ok();
    }
}

看來是 session == NULL 所造成

不過當下的 session 不可能是 NULL


另外快速的從 menu 選單來切換 web page 時

導到 login 畫面也是 session == NULL 所造成


get_session 如下

static session_t *get_session(void)
{
    if (jweb.in.session == NULL)
    {
        return NULL;
    }


    // uuid_parse - convert an input UUID string into binary representation
    uuid_t uuid;
    uuid_parse(jweb.in.session, uuid);

    for (int i = 0; i < NUM_SESSIONS; i++)
    {
        /*
        ** uuid_compare - compare whether two UUIDs are the same
        ** Returns an integer less than, equal to, or greater than zero if uu1 is found, respectively,
        ** to be lexigraphically less than, equal, or greater than uu2.
        */
        if (uuid_compare(Session_store[i].session_id, uuid) == 0)
        {
            Session_store[i].last_used = (double)SysGetUpTime(); // update
            save_session_store();
            return &Session_store[i];
        }
    }

    return NULL;
}

放幾個 debug 來追問題

diff --git a/proscend/prosrc/webcgi/jweb.c b/proscend/prosrc/webcgi/jweb.c
index 205ca30..213614e 100644
--- a/proscend/prosrc/webcgi/jweb.c
+++ b/proscend/prosrc/webcgi/jweb.c
@@ -18,6 +18,14 @@



+#define JWEB_LOG                LOG_DIR"/jweb.log"
+#define JWEB_DBG(FMT, ARG...)   IPC_filelog_v2(JWEB_LOG, IPCF_LOGMAX, __FUNCTION__, __LINE__, IPCFv2_SHOW_TIME, FMT, ##ARG)
+
+
+
+
+
+
 static void api_login(void);
 static void api_whoAmI(void);
 static void api_logout(void);
@@ -459,13 +467,11 @@ static void destroy_session(session_t *s)



-
-
-
 static session_t *get_session(void)
 {
     if (jweb.in.session == NULL)
     {
+        JWEB_DBG("jweb.in.session NULL\n");
         return NULL;
     }

@@ -483,12 +489,14 @@ static session_t *get_session(void)
         */
         if (uuid_compare(Session_store[i].session_id, uuid) == 0)
         {
+            JWEB_DBG("fount session at Session_store[%d]\n", i);
             Session_store[i].last_used = (double)SysGetUpTime(); // update
             save_session_store();
             return &Session_store[i];
         }
     }

+    JWEB_DBG("no match session found\n");
     return NULL;
 }

(END)

快速的作選單切換 複製出問題

jweb.log 如下

root@ICR-401:/home/admin# cat /home/log/jweb.log
...
1582044309[20200218 16:45:09] [get_session:492]fount session at Session_store[0]
1582044309[20200218 16:45:09] [get_session:492]fount session at Session_store[0]
1582044309[20200218 16:45:09] [get_session:492]fount session at Session_store[0]
1582044309[20200218 16:45:09] [get_session:499]no match session found
1582044309[20200218 16:45:09] [get_session:492]fount session at Session_store[0]
1582044309[20200218 16:45:09] [get_session:492]fount session at Session_store[0]
...
root@ICR-401:/home/admin#

如果在 no match session found 發生的當下

sleep(1) 後再讀一次會怎樣呢?

diff --git a/proscend/prosrc/webcgi/jweb.c b/proscend/prosrc/webcgi/jweb.c
index 205ca30..9c69974 100644
--- a/proscend/prosrc/webcgi/jweb.c
+++ b/proscend/prosrc/webcgi/jweb.c
@@ -18,6 +18,14 @@



+#define JWEB_LOG                LOG_DIR"/jweb.log"
+#define JWEB_DBG(FMT, ARG...)   IPC_filelog_v2(JWEB_LOG, IPCF_LOGMAX, __FUNCTION__, __LINE__, IPCFv2_SHOW_TIME, FMT, ##ARG)
+
+
+
+
+
+
 static void api_login(void);
 static void api_whoAmI(void);
 static void api_logout(void);
@@ -459,13 +467,11 @@ static void destroy_session(session_t *s)



-
-
-
 static session_t *get_session(void)
 {
     if (jweb.in.session == NULL)
     {
+        JWEB_DBG("jweb.in.session NULL\n");
         return NULL;
     }

@@ -483,12 +489,35 @@ static session_t *get_session(void)
         */
         if (uuid_compare(Session_store[i].session_id, uuid) == 0)
         {
+            JWEB_DBG("1st:fount session at Session_store[%d]\n", i);
+            Session_store[i].last_used = (double)SysGetUpTime(); // update
+            save_session_store();
+            return &Session_store[i];
+        }
+    }
+
+    JWEB_DBG("1st:no match session found\n");
+
+    sleep(1); // give anoth cgi finish this function
+
+    for (int i = 0; i < NUM_SESSIONS; i++)
+    {
+        /*
+        ** uuid_compare - compare whether two UUIDs are the same
+        ** Returns an integer less than, equal to, or greater than zero if uu1 is found, respectively,
+        ** to be lexigraphically less than, equal, or greater than uu2.
+        */
+        if (uuid_compare(Session_store[i].session_id, uuid) == 0)
+        {
+            JWEB_DBG("2st:fount session at Session_store[%d]\n", i);
+            Session_store[i].last_used = (double)SysGetUpTime(); // update
+            save_session_store();
+            return &Session_store[i];
+        }
+    }
+
+    JWEB_DBG("2st:no match session found\n");
+
+
+
     return NULL;
 }

(END)

1120

看起來沒用

root@ICR-401:/home/admin# cat /home/log/jweb.log | grep match
1582047205[20200218 17:33:25] [get_session:499]1st:no match session found
1582047206[20200218 17:33:26] [get_session:519]2st:no match session found

一失敗就會接連失敗

為何會失敗呢?


感覺是 init_session_store 的時候就失敗了

static int init_session_store(void)
{
    init_session_store_path();

    if (load_session_store() != ICOS_SUCCESS)
    {
        memset(Session_store, 0, sizeof(Session_store));

        for (int i = 0; i < NUM_SESSIONS; i ++)
        {
            // reset value of UUID variable to the NULL value
            uuid_clear(Session_store[i].session_id);
        }

        save_session_store();
    }
}

放個 debug 確認

@@ -384,6 +392,8 @@ static int init_session_store(void)

     if (load_session_store() != ICOS_SUCCESS)
     {
+        JWEB_DBG("load_session_store fail\n");
+
         memset(Session_store, 0, sizeof(Session_store));

         for (int i = 0; i < NUM_SESSIONS; i ++)
@@ -459,13 +469,11 @@ static void destroy_session(session_t *s)



-
-
-
 static session_t *get_session(void)
 {
     if (jweb.in.session == NULL)
     {
+        JWEB_DBG("jweb.in.session NULL\n");
         return NULL;
     }

@@ -483,12 +491,15 @@ static session_t *get_session(void)
         */
         if (uuid_compare(Session_store[i].session_id, uuid) == 0)
         {
+            JWEB_DBG("fount session at Session_store[%d]\n", i);
             Session_store[i].last_used = (double)SysGetUpTime(); // update
             save_session_store();
             return &Session_store[i];
         }
     }

+    JWEB_DBG("no match session found\n");
+
     return NULL;
 }

只顯示 no match session found

...
1582048185[20200218 17:49:45] [get_session:501]no match session found
...

sleep(1) 後再 load session 一次 ?

@@ -384,6 +392,8 @@ static int init_session_store(void)

     if (load_session_store() != ICOS_SUCCESS)
     {
+        JWEB_DBG("load_session_store fail\n");
+
         memset(Session_store, 0, sizeof(Session_store));

         for (int i = 0; i < NUM_SESSIONS; i ++)
@@ -459,13 +469,11 @@ static void destroy_session(session_t *s)



-
-
-
 static session_t *get_session(void)
 {
     if (jweb.in.session == NULL)
     {
+        JWEB_DBG("jweb.in.session NULL\n");
         return NULL;
     }

@@ -483,12 +491,44 @@ static session_t *get_session(void)
         */
         if (uuid_compare(Session_store[i].session_id, uuid) == 0)
         {
+            JWEB_DBG("1st - found session at Session_store[%d]\n", i);
+            Session_store[i].last_used = (double)SysGetUpTime(); // update
+            save_session_store();
+            return &Session_store[i];
+        }
+    }
+
+    JWEB_DBG("1st - no match session found\n");
+
+    sleep(1);
+
+    if (load_session_store() != ICOS_SUCCESS)
+    {
+        JWEB_DBG("load_session_store again fail\n");
+        return NULL;
+    }
+
+    JWEB_DBG("load_session_store again ok\n");
+
+    for (int i = 0; i < NUM_SESSIONS; i++)
+    {
+        /*
+        ** uuid_compare - compare whether two UUIDs are the same
+        ** Returns an integer less than, equal to, or greater than zero if uu1 is found, respectively,
+        ** to be lexigraphically less than, equal, or greater than uu2.
+        */
+        if (uuid_compare(Session_store[i].session_id, uuid) == 0)
+        {
+            JWEB_DBG("2nd - found session at Session_store[%d]\n", i);
             Session_store[i].last_used = (double)SysGetUpTime(); // update
             save_session_store();
             return &Session_store[i];
         }
     }

+    JWEB_DBG("2nd - no match session found\n");
+
+
+
     return NULL;
 }

(END)
root@ICR-401:/home/admin# cat /home/log/jweb.log
...
1582048968[20200218 18:02:48] [get_session:494]1st - found session at Session_store[0]
...
1582048970[20200218 18:02:50] [get_session:501]1st - no match session found
1582048971[20200218 18:02:51] [get_session:511]load_session_store again ok
1582048971[20200218 18:02:51] [get_session:522]2nd - found session at Session_store[0]
...

看起來有效喔

整理一下

再好好進行一下測試

diff --git a/proscend/prosrc/webcgi/jweb.c b/proscend/prosrc/webcgi/jweb.c
index 205ca30..4633b28 100644
--- a/proscend/prosrc/webcgi/jweb.c
+++ b/proscend/prosrc/webcgi/jweb.c
@@ -18,6 +18,14 @@



+#define JWEB_LOG                LOG_DIR"/jweb.log"
+#define JWEB_DBG(FMT, ARG...)   IPC_filelog_v2(JWEB_LOG, IPCF_LOGMAX, __FUNCTION__, __LINE__, IPCFv2_SHOW_TIME, FMT, ##ARG)
+
+
+
+
+
+
 static void api_login(void);
 static void api_whoAmI(void);
 static void api_logout(void);
@@ -384,6 +392,8 @@ static int init_session_store(void)

     if (load_session_store() != ICOS_SUCCESS)
     {
+        JWEB_DBG("load_session_store fail\n");
+
         memset(Session_store, 0, sizeof(Session_store));

         for (int i = 0; i < NUM_SESSIONS; i ++)
@@ -459,13 +469,11 @@ static void destroy_session(session_t *s)



-
-
-
 static session_t *get_session(void)
 {
     if (jweb.in.session == NULL)
     {
+        JWEB_DBG("jweb.in.session NULL\n");
         return NULL;
     }

@@ -489,6 +497,36 @@ static session_t *get_session(void)
         }
     }

+    JWEB_DBG("no match session found, sleep(1) and try again\n");
+
+    sleep(1);
+
+    if (load_session_store() != ICOS_SUCCESS)
+    {
+        JWEB_DBG("load_session_store again fail\n");
+        return NULL;
+    }
+
+    for (int i = 0; i < NUM_SESSIONS; i++)
+    {
+        /*
+        ** uuid_compare - compare whether two UUIDs are the same
+        ** Returns an integer less than, equal to, or greater than zero if uu1 is found, respectively,
+        ** to be lexigraphically less than, equal, or greater than uu2.
+        */
+        if (uuid_compare(Session_store[i].session_id, uuid) == 0)
+        {
+            JWEB_DBG("found session at Session_store[%d] after re-load_session_store\n", i);
+            Session_store[i].last_used = (double)SysGetUpTime(); // update
+            save_session_store();
+            return &Session_store[i];
+        }
+    }
+
+    JWEB_DBG("no match session found after re-load_session_store\n");
+
+
+
     return NULL;
 }

(END)

1300

DQA 反應 m300 的問題

hardware mcsv 0137

可以 upgrade software 0136 的 firmware

但 upgrade 後會被改成 0137

剛剛看了 source code

# MCSV check
function mcsv_check {
    log "\nMCSV check ..."
    progress_status "MCSV check ..."
    cd /tmp/firmware

    if [ ! -e "mcsv.enc" ]; then
        log "mcsv.enc not exit, bypass MCSV check"
        progress_status "mcsv.enc not exit, bypass MCSV check"
        return 0
    fi

    log "mcsv.enc exist, decrypt it and check with hardware MCSV"
    log "decrypt mcsv.en"
    openssl des3 -d -salt -in mcsv.enc -out mcsv -k 2wsx#EDC
    if [ $? != 0 ]; then
        log "Error: decrypt mcsv.enc failed"
        progress_fail "Error: decrypt mcsv.enc failed"
        return 1
    fi

    sw_mcsv=$(cat mcsv)
    log "software MCSV: ${sw_mcsv}"

    sw_mcsv_mmmm=$(echo ${sw_mcsv} | cut -c 1-4)
    log "software MCSV-MMMM: ${sw_mcsv_mmmm}"
    sw_mcsv_cccc=$(echo ${sw_mcsv} | cut -c 5-8)
    log "software MCSV-CCCC: ${sw_mcsv_cccc}"

    hw_mcsv=$(cat /tmp/etc/sysinfo.txt | grep HW_MCSV | cut -c 9-24)
    if [ -z "${hw_mcsv}" ]; then
        log "Error: hw_mcsv not exist, MCSV check failed"
        progress_fail "Error: hw_mcsv not exist, MCSV check failed"
        return 1
    fi

    log "hardware MCSV: ${hw_mcsv}"

    hw_mcsv_mmmm=$(echo ${hw_mcsv} | cut -c 1-4)
    log "hardware MCSV-MMMM: ${hw_mcsv_mmmm}"
    hw_mcsv_cccc=$(echo ${hw_mcsv} | cut -c 5-8)
    log "hardware MCSV-CCCC: ${hw_mcsv_cccc}"



    # +-----------------------+----------+----------+----------+----------------------------------+
    # | Model Name | Product  | H/W      | Firmware | S/W      | Description                      |
    # |            | ID       | MCSV     | ID       | MCSV     |                                  |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300       | 300      | 012C     | 300      | 012C     | LTE, 1 WAN, 1 LAN                |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301       | 301      | 012D     | 300      | 012C     | LTE, 1 WAN, 3 LAN                |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-G     | 310      | 0136     | 310      | 0136     | LTE, 1 WAN, 1 LAN, GPS           |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-G     | 311      | 0137     | 310      | 0136     | LTE, 1 WAN, 3 LAN, GPS           |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-GW    | 320      | 0140     | 320      | 0140     | LTE, 1 WAN, 1 LAN, GPS, WiFi     |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-GW    | 321      | 0141     | 320      | 0140     | LTE, 1 WAN, 3 LAN, GPS, WiFi     |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-PG    | 330      | 014A     | 310      | 0136     | LTE, 1 WAN(PD), 1 LAN, GPS       |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-PG    | 331      | 014B     | 310      | 0136     | LTE, 1 WAN(PD), 3 LAN, GPS       |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-PGW   | 340      | 0154     | 320      | 0140     | LTE, 1 WAN(PD), 1 LAN, GPS       |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-PGW   | 341      | 0155     | 320      | 0140     | LTE, 1 WAN(PD), 3 LAN, GPS       |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-T     | 350      | 015E     | 350      | 015E     | LTE, 1 WAN, 1 LAN                |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-T     | 351      | 015F     | 350      | 015E     | LTE, 1 WAN, 3 LAN                |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M300-TG    | 360      | 0168     | 360      | 0168     | LTE, 1 WAN, 1 LAN, GPS           |
    # +------------+----------+----------+----------+----------+----------------------------------+
    # | M301-TG    | 361      | 0169     | 360      | 0168     | LTE, 1 WAN, 3 LAN, GPS           |
    # +------------+----------+----------+----------+----------+----------------------------------+

    result=0
    if   [ "${hw_mcsv_mmmm}" == "012C" ] || [ "${hw_mcsv_mmmm}" == "012D" ]
    then
        # M300/M301 can use firmware ID 300 (S/W MCSV 012C)
        if [ "${sw_mcsv_mmmm}" != "012C" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "0136" ] || [ "${hw_mcsv_mmmm}" == "0137" ]
    then
        # M300-G/M301-G can use firmware ID 310 (S/W MCSV 0136)
        if [ "${sw_mcsv_mmmm}" != "0136" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "0140" ] || [ "${hw_mcsv_mmmm}" == "0141" ]
    then
        # M300-GW/M301-GW can use firmware ID 320 (S/W MCSV 0140)
        if [ "${sw_mcsv_mmmm}" != "0140" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "014A" ] || [ "${hw_mcsv_mmmm}" == "014B" ]
    then
        # M300-PG/M301-PG can use firmware ID 310 (S/W MCSV 0136)
        if [ "${sw_mcsv_mmmm}" != "0136" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "0154" ] || [ "${hw_mcsv_mmmm}" == "0155" ]
    then
        # M300-PGW/M301-PGW can use firmware ID 320 (S/W MCSV 0140)
        if [ "${sw_mcsv_mmmm}" != "0140" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "015E" ] || [ "${hw_mcsv_mmmm}" == "015F" ]
    then
        # M300-T/M301-T can use firmware ID 350 (S/W MCSV 015E)
        if [ "${sw_mcsv_mmmm}" != "015E" ]; then
            result=1
        fi
    elif [ "${hw_mcsv_mmmm}" == "0168" ] || [ "${hw_mcsv_mmmm}" == "0169" ]
    then
        # M300-TG/M301-TG can use firmware ID 360 (S/W MCSV 0168)
        if [ "${sw_mcsv_mmmm}" != "0168" ]; then
            result=1
        fi
    else
        # Default check - Reject if the Upgrade Image with different Model ID with HW MCSV
        if [ "${sw_mcsv_mmmm}" != "${hw_mcsv_mmmm}" ]; then
            result=1
        fi
    fi

    if [ $result -eq 1 ]; then
        log "Error: Model ID not match, MCSV check failed"
        progress_fail "Error: Model ID not match, MCSV check failed"
        echo "Error: Model ID not match, MCSV check failed"
        return
    fi


    # - If HW MCSV¡¦s and SW MCSV¡¦s custom ID=0000/0001 (i.e. Proscend)
    #   - allow to upgrade the image with all custom ID
    # - If HW MCSV¡¦s custom ID=0000/0001 (i.e. Proscend) and SW MCSV¡¦s custom ID!=0000/0001
    #   - allow upgrade the image with the same CID as SW MCSV¡¦s CID
    #   - reject other mcsv
    # - If HW MCSV¡¦s CID!=0000/0001 (i.e. Proscend)
    #   - reject the upgrade image with different CID
    if [ "${hw_mcsv_cccc}" == "0000" ] || [ "${hw_mcsv_cccc}" == "0001" ]
    then
        log "Hardware customer ID is '0000' or '0001'"
        if [ "${sw_mcsv_cccc}" == "0000" ] || [ "${sw_mcsv_cccc}" == "0001" ]
        then
            log "Software Customer ID is '0000' or '0001'"
            log "Allow to upgrade"
            log "MCSV check succeeded"
            progress_status "MCSV check succeeded"
        else
            log "Software Customer ID is not '0000' or '0001'"
            log "Allow to upgrade"
            log "Reject other Customer ID"
            log "MCSV check succeeded"
            progress_status "MCSV check succeeded"
            fw_setenv hw_mcsv ${sw_mcsv}
        fi
    elif [ "${hw_mcsv_cccc}" == "0002" ]
    then
        log "Hardware customer ID is '0002' - PLANET"
        if [ "${sw_mcsv_cccc}" == "0002" ] || [ "${sw_mcsv_cccc}" == "0080" ]
        then
            log "Software Customer ID is '0002' or '0008'"
            log "Allow to upgrade"
            log "MCSV check succeeded"
            progress_status "MCSV check succeeded"
            fw_setenv hw_mcsv ${sw_mcsv}
        else
            log "Error: Customer ID not match, MCSV check failed"
            progress_fail "Error: Customer ID not match, MCSV check failed"
            echo "Error: Customer ID not match, MCSV check failed"
            return
        fi
    else
        log "Hardware customer ID is not '0000' or '0001'"
        if [ "${sw_mcsv_cccc}" != "${hw_mcsv_cccc}" ]; then
            log "Error: Customer ID not match, MCSV check failed"
            progress_fail "Error: Customer ID not match, MCSV check failed"
            echo "Error: Customer ID not match, MCSV check failed"
            return
        fi
        log "MCSV check succeeded"
        progress_status "MCSV check succeeded"
    fi

    cd - > /dev/null
}

如果 upgrade 又牽涉到 CID 從 generic (0000) upgrade 成某個客戶的版本

model 0137 的確會被蓋掉

不過實際作一次實驗搭配 log 會比較放心

跑一趟 DQA 找 borchen 聊一下吧


的確是我懷疑的現象

已請 borchen 發 issue

這個 bug 修正 firmware upgrade script 裡的 mcsv_check 即可

修正的 branch 為 M300[develop]

相關的 mantis issue 如下

1330

john 用一台 m350 跟 m330 測 gre 時發現

m350 的 grek 執行時會發生 segmentation fault


發現我的 m350 不會

但 john 的 m350 會

john 的 m350 執行以下的程式就會出錯

#include <signal.h>
#include <time.h>
#include <stdlib.h>

#define TIMER_SIG SIGRTMAX              /* Our timer notification signal */

int main(int argc, char *argv[])
{

    struct sigevent   sev;

    sev.sigev_notify = SIGEV_SIGNAL;    /* Notify via signal */
    sev.sigev_signo = TIMER_SIG;        /* Notify using this signal */

    timer_t tid;

    if (timer_create(CLOCK_REALTIME, &sev, &tid) == -1)
    {
        printf("errExit: timer_create\n");
        exit(EXIT_FAILURE);
    }
    printf("Timer ID: %ld (%s)\n", (long) tid);

}

出錯的情況如下

root@ICR-401:/tmp# ./grek
Segmentation fault

john 表示可能是他之前查問題的時候調整到什麼 library 影響到了

他今天下班時會重 build

我就幫忙到這裡即可

1420

新訂單 - 新的客製化工作

Dear Team,

Since Advice make order 300 units of M330-W, I add ADVICE profile (release/v1.00 branch).

Please check in code into (release/V1.00) branch because we plan to release on Friday.


Dear Jeffrey,

Please port Advice Web UI style from M300 into M330. 

有訂單就優先處理


先等我 好好進行一下測試

關於 issue - 0000922: sometimes when browser issue cgi request, some cgi will response 401 even we already login


session timeout 也要試一下

確認不能受影響

測了一次 確認沒有受影響

1515

上 code 吧

m350[develop] - web session bug

commit 59fbc8063ee7ff5c83d76e37065797824f1c603e
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Feb 19 15:32:11 2020 +0800

    web session bug

    when
    after login, session timeout not yet

    what
    sometimes multiple concurrent CGI requests will cause a issue
    some cgi will get 401 return and then the browder will redirect to login page

    why
    401 return is cause by we found no match session id

    how(workaround)
    but if we sleep(1) and load_session_store then search again
    we will find the match session id

 proscend/prosrc/webcgi/jweb.c | 62 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 59 insertions(+), 3 deletions(-)

可以套到其他平台去囉

1615

參考 使用 Git 時如何做出跨 repo 的 cherry-pick

試著套到 M300[develop] 去

操作如下

➜  m350 git:(develop) ✗ git format-patch -k --stdout 92f219ef9c68c930075be454eb697481324654a7..59fbc8063ee7ff5c83d76e37065797824f1c603e > ~/tmp/m350_web_session_bug.patch
➜  m350 git:(develop) ✗

不太知道發生甚麼事

➜  M300 git:(develop) ✗ git am -k -3 ~/tmp/m350_web_session_bug.patch
Applying: web session bug
fatal: sha1 information is lacking or useless (proscend/prosrc/webcgi/jweb.c).
error: could not build fake ancestor
Patch failed at 0001 web session bug
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

google git am fatal: sha1 information is lacking or useless 得到

套招 patch -p1 < example.patch

➜  M300 git:(develop) ✗ patch -p1 < ~/tmp/m350_web_session_bug.patch
patching file proscend/prosrc/webcgi/jweb.c
Hunk #1 succeeded at 19 (offset 1 line).
Hunk #3 FAILED at 469.
Hunk #4 succeeded at 496 (offset -3 lines).
1 out of 4 hunks FAILED -- saving rejects to file proscend/prosrc/webcgi/jweb.c.rej

越來越不知道發生什麼事

再做一次

➜  M300 git:(develop) ✗ git am -k -3 ~/tmp/m350_web_session_bug.patch
fatal: previous rebase directory .git/rebase-apply still exists but mbox given.

到底發生啥事???

➜  M300 git:(develop) ✗ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.
You are in the middle of an am session.
  (fix conflicts and then run "git am --continue")
  (use "git am --skip" to skip this patch)
  (use "git am --abort" to restore the original branch)

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

        modified:   proscend/prosrc/webcgi/jweb.c

Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .bash_history
        ...
        proscend/prosrc/webcgi/jweb.c.orig
        proscend/prosrc/webcgi/jweb.c.rej

no changes added to commit (use "git add" and/or "git commit -a")

該加的加 該刪的刪

➜  M300 git:(develop) ✗ git add proscend/prosrc/webcgi/jweb.c
➜  M300 git:(develop) ✗ rm proscend/prosrc/webcgi/jweb.c.orig
➜  M300 git:(develop) ✗ rm proscend/prosrc/webcgi/jweb.c.rej
➜  M300 git:(develop) ✗ git status
On branch develop
Your branch is ahead of 'origin/develop' by 1 commit.
  (use "git push" to publish your local commits)
Untracked files:
  (use "git add <file>..." to include in what will be committed)

        .bash_history
        .subversion/
        ...

nothing added to commit but untracked files present (use "git add" to track)

正常了???

build 個 image 來試試吧

也用 ie 試試看

看來效果不錯

不過發現套的不完全

沒關係 還沒 push 都有的救


半手動從 m350 套用

M300[develop] - output information base on different error

commit 46efb7381b411a608e163acd98d51c936944c4ac
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Feb 19 10:00:59 2020 +0800

    output information base on different error

 proscend/prosrc/webcgi/jweb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

M300[develop] - web session bug

commit d3ab6c2902e0313c73970c191119567e0c116733
Refs: [develop], {origin/develop}
Author: jeffrey <[email protected]>
Date:   Wed Feb 19 17:33:05 2020 +0800

    web session bug

    when
    after login, session timeout not yet

    what
    sometimes multiple concurrent CGI requests will cause a issue
    some cgi will get 401 return and then the browder will redirect to login page

    why
    401 return is cause by we found no match session id

    how(workaround)
    but if we sleep(1) and load_session_store then search again
    we will find the match session id

 proscend/prosrc/webcgi/jweb.c | 59 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

1740

順道修一下今天的 issue

⚠️ **GitHub.com Fallback** ⚠️