# コードブロックのエラー: 403 Forbidden

**URL:** <https://meta.discourse.org/t/error-with-code-blocks-403-forbidden/280764>\
**Category:** Product Support\
**Created:** [2023 年 10 月 2 日午後 4:12 UTC](https://meta.discourse.org/t/error-with-code-blocks-403-forbidden/280764 "2023-10-02T16:12:13Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![gkaf89](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gkaf89/32/330594_2.png) [@gkaf89](https://meta.discourse.org/u/gkaf89)\
**Post date:** [2023 年 10 月 2 日午後 4:12 UTC](https://meta.discourse.org/t/error-with-code-blocks-403-forbidden/280764/1 "2023-10-02T16:12:13Z")

</div>

ディスコースサーバーの管理を引き継いだばかりですが、いくつか問題があります。

1. コードブロックを含む投稿の作成または編集を試みると、常に問題が発生します。コードブロックを含む投稿の作成または編集を試みると、

```plaintext
(access node)$ spack list openfoam@2306
...
Variants:
    Name [Default] When Allowed values Description
    ====================== ==== ============== ==================================================

    build_system [generic] -- generic Build systems supported by the package
    int64 [off] -- on, off With 64-bit labels
    kahip [off] -- on, off With kahip decomposition
    knl [off] -- on, off Use KNL compiler settings
    metis [off] -- on, off With metis decomposition
    mgridgen [off] -- on, off With mgridgen support
    paraview [off] -- on, off Build paraview plugins and runtime post-processing
    precision [dp] -- sp, dp, spdp Precision option
    scotch [on] -- on, off With scotch/ptscotch decomposition
    source [on] -- on, off Install library/application sources and tutorials
    vtk [off] -- on, off With VTK runTimePostProcessing
    zoltan [off] -- on, off With zoltan renumbering
...

```

`403 Forbidden` というエラーが発生します。

1. Markdown はコードハイライトをサポートしておらず、構文指定を追加すると `403 Forbidden` エラーが発生します。

2. インラインコードセグメントも、他のコードブロックとの相対位置によっては、一部の場所で `403 Forbidden` を引き起こします。

インストールされているバージョンは 3.1.1 ( [0612f0d5b6](https://github.com/discourse/discourse/commits/0612f0d5b60708cadffc8b7ebad1419eda96f60b) ) です。

これらの問題は関連していますか、また、この動作の原因は何でしょうか？

_投稿例:_ [Compiling OpenFOAM with Spack - 📚 Knowledge nuggets - HPC discourse](https://hpc-discourse.uni.lu/t/compiling-openfoam-with-spack/109)

# 意図した結果:

Spack を使用した OpenFOAM (OpenCFD) のインストールには、いくつかの問題があります。

UL HPC のチュートリアルに従って Spack でパッケージを管理するために環境が設定されました。簡単に言うと、SPACK パッケージの以下の依存関係が定義されました。

```bash
(access node)$ cat << EOF > $SPACK_ROOT/etc/spack/packages.yaml
packages:
    slurm:
        externals:
        - spec: slurm@22.05.5
          prefix: /usr
        buildable: False
    libevent:
        externals:
        - spec: libevent@2.1.8
          prefix: /usr
        buildable: False
    pmix:
        externals:
        - spec: pmix@4.2.3
          prefix: /usr
        buildable: False
    hwloc:
        externals:
        - spec: hwloc@2.2.0
          prefix: /usr
        buildable: False
EOF

```

また、ビルドキャッシュディレクトリの以下のオプションが定義され、

```bash
(access)$ cat << EOF > $SPACK_ROOT/etc/spack/config.yaml
config:
    build_stage:
        - /dev/shm/$user/spack-stage
EOF

```

RAM ディスクファイルシステムを使用してコンパイルを高速化しました。OpenFOAM のインストールに進む前に、システムコンパイラを使用して目的のバージョンの Open MPI がインストールされます。

```bash
(compute node)$ spack install -j openmpi@4.0.5 +pmi schedulers=slurm ^pmix@4.2.3 ^hwloc@2.2.0

```

OpenFOAM のディストリビューションもシステムコンパイラを使用してインストールされます。利用可能な OpenFOAM のコンポーネントは次のとおりです。

```plaintext
(access node)$ spack list openfoam@2306
...
Variants:
    Name [Default] When Allowed values Description
    ====================== ==== ============== ==================================================

    build_system [generic] -- generic Build systems supported by the package
    int64 [off] -- on, off With 64-bit labels
    kahip [off] -- on, off With kahip decomposition
    knl [off] -- on, off Use KNL compiler settings
    metis [off] -- on, off With metis decomposition
    mgridgen [off] -- on, off With mgridgen support
    paraview [off] -- on, off Build paraview plugins and runtime post-processing
    precision [dp] -- sp, dp, spdp Precision option
    scotch [on] -- on, off With scotch/ptscotch decomposition
    source [on] -- on, off Install library/application sources and tutorials
    vtk [off] -- on, off With VTK runTimePostProcessing
    zoltan [off] -- on, off With zoltan renumbering
...

```

OpenFOAM は、利用可能なすべてのパーティショナー (`metis`、`scotch`、`zoltan`、`kahip`) およびマルチグリッドジェネレータコンポーネント (ドキュメントのセクション 6.3.1.4) を使用してインストールされます。

```bash
(compute node)$ spack install -j openfoam@2306 +source precision=dp +metis +scotch +zoltan +kahip +mgridgen ~knl ~int64 ~paraview ^openmpi@4.0.5

```

しかし、結果のインストールでは複数のコンポーネントが欠落しています。たとえば、`doc/Build.md` で手動のインストール後検証を実行すると、

```bash
# Create the user "run" directory:
mkdir -p "$FOAM_RUN"
# Change to the user "run" directory:
run
# Copy tutorial
cp -r "$FOAM_TUTORIALS"/incompressible/simpleFoam/pitzDaily ./
# Run the tutorial
( cd pitzDaily && blockMesh && simpleFoam )

```

メッシュジェネレータ `blockMesh` とソルバー `simpleFoam` の両方が欠落しています。

METIS パーティショナーが複数のコンポーネントのインストールに失敗することが判明しました。SCOTCH パーティショナーのみで再コンパイルすると、

```bash
(compute node)$ spack install openfoam@2306 +source +scotch +mgridgen precision=dp ~int64 ~kahip ~knl ~metis ~paraview ~vtk ~zoltan ^openmpi@4.0.5

```

問題は解決します。すべてのソルバーコンポーネントがインストールされますが、いくつかのユーティリティはまだ欠落しています。

欠落しているすべてのコンポーネントを検出するために、次のスクリプトを使用します。

```bash
(access node)$ cat list_spack_openfoam
#!/usr/bin/bash

set -euo pipefail

declare variant="${1}" # e.g. @2306%gcc@8.5.0 @2306+mgridgen
declare type="${2}" # solvers, utilities

find_makefile_directories() {
    local directory="${1}"

    find "${directory}" -type d | grep -E '\/Make$' || true
}

extract_executable_name() {
    local makefile_directory="${1}"

    cat "${makefile_directory}/files" | ( grep -E '^EXE[[:space:]]*=' || true ) | sed 's/^EXE[[:space:]]*=[[:space:]]*\$(FOAM_APPBIN)\///g'
}

main() {
    local variant="${1}"
    local type="${2}"

    local foam_location="$(spack location -i openfoam"${variant}")"

    local pagkage_directory=""
    local executable_name=""
    local installed=""
    local package_makefile_directory=""
    while read -r package_makefile_directory; do
        executable_name=$( extract_executable_name "${package_makefile_directory}" )

        if [-n "${executable_name}"]; then
            if [-x "${foam_location}/platforms/linux64GccDPInt32-spack/bin/${executable_name}"]; then
                installed="Y"
            else
                installed="N"
            fi
            package_directory="$( echo "${package_makefile_directory}" | xargs -I % dirname % )"

            echo "${installed} : ${executable_name} => ${package_directory#${foam_location}}"
        fi
    done < <( find_makefile_directories "${foam_location}/applications/${type}" )
}

main "${variant}" "${type}"

```

スクリプトを単純に実行すると、次のユーティリティが欠落していることが示されます。

```plaintext
(access node)$ ./list_spack_openfoam utilities @2306 | grep -E '^N'
N : addr2line => /applications/utilities/miscellaneous/OSspecific/addr2line
N : foamyHexMeshSurfaceSimplify => /applications/utilities/mesh/generation/foamyMesh/foamyHexMeshSurfaceSimplify
N : foamyHexMeshBackgroundMesh => /applications/utilities/mesh/generation/foamyMesh/foamyHexMeshBackgroundMesh
N : cellSizeAndAlignmentGrid => /applications/utilities/mesh/generation/foamyMesh/cellSizeAndAlignmentGrid
N : foamToCcm => /applications/utilities/mesh/conversion/ccm/foamToCcm
N : ccmToFoam => /applications/utilities/mesh/conversion/ccm/ccmToFoam

```

---

_[View the full topic](https://meta.discourse.org/t/error-with-code-blocks-403-forbidden/280764)._
